Bird
0
0

Given these tests:

medium📝 Predict Output Q4 of 15
PyTest - Markers
Given these tests:
@pytest.mark.slow
def test_slow(): pass

@pytest.mark.fast
def test_fast(): pass

What tests run with the command pytest -m 'slow or fast'?
ABoth test_slow and test_fast run
BOnly test_slow runs
COnly test_fast runs
DNo tests run
Step-by-Step Solution
Solution:
  1. Step 1: Understand marker expression 'slow or fast'

    This expression selects tests marked with either 'slow' or 'fast'.
  2. Step 2: Identify tests matching markers

    Both test_slow and test_fast have these markers, so both run.
  3. Final Answer:

    Both test_slow and test_fast run -> Option A
  4. Quick Check:

    Marker 'slow or fast' runs both tests [OK]
Quick Trick: Use 'or' to run tests with either marker [OK]
Common Mistakes:
MISTAKES
  • Assuming only one marker runs
  • Confusing 'or' with 'and'
  • Ignoring marker expressions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes