Bird
0
0

Which command runs only tests marked with 'database' in pytest?

easy🧠 Conceptual Q2 of 15
PyTest - Markers
Which command runs only tests marked with 'database' in pytest?
Apytest --run-database
Bpytest -m database
Cpytest -mark database
Dpytest --only database
Step-by-Step Solution
Solution:
  1. Step 1: Recall pytest syntax for running marked tests

    The correct syntax uses '-m' followed by the marker name to select tests.
  2. Step 2: Verify options against pytest documentation

    Only 'pytest -m database' matches the correct command format.
  3. Final Answer:

    pytest -m database -> Option B
  4. Quick Check:

    Run marked tests = pytest -m [OK]
Quick Trick: Use '-m' to run tests by marker name [OK]
Common Mistakes:
MISTAKES
  • Using '--run-database' which is invalid
  • Typing '-mark' instead of '-m'
  • Using '--only' which pytest doesn't support

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes