Bird
0
0

You want to run only tests marked as 'slow' using pytest. Which command correctly runs these tests?

hard🚀 Application Q8 of 15
PyTest - Basics and Setup
You want to run only tests marked as 'slow' using pytest. Which command correctly runs these tests?
Apytest -m slow
Bpytest --run-slow
Cpytest --only slow
Dpytest --filter slow
Step-by-Step Solution
Solution:
  1. Step 1: Understand pytest markers

    pytest allows marking tests with @pytest.mark.slow and running them with -m option.
  2. Step 2: Identify correct command to run marked tests

    pytest -m slow runs only tests marked with 'slow'. Other options are invalid.
  3. Final Answer:

    pytest -m slow -> Option A
  4. Quick Check:

    Run marked tests = pytest -m [OK]
Quick Trick: Use pytest -m marker to run marked tests [OK]
Common Mistakes:
MISTAKES
  • Using wrong flags
  • Assuming --run-slow exists
  • Confusing filter options

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes