Bird
0
0

Given these tests marked in pytest:

medium📝 Predict Output Q4 of 15
PyTest - Markers
Given these tests marked in pytest:
@pytest.mark.fast
def test_a(): pass

@pytest.mark.slow
def test_b(): pass

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

What tests run with pytest -m fast?
Atest_b and test_c
Btest_b only
Ctest_a and test_c
Dtest_a only
Step-by-Step Solution
Solution:
  1. Step 1: Identify tests marked with 'fast'

    test_a and test_c have '@pytest.mark.fast', test_b has 'slow'.
  2. Step 2: Understand pytest -m filter

    Running 'pytest -m fast' runs only tests marked 'fast'.
  3. Final Answer:

    test_a and test_c -> Option C
  4. Quick Check:

    Marker filter runs matching tests [OK]
Quick Trick: Only tests with the marker run with '-m' [OK]
Common Mistakes:
MISTAKES
  • Running all tests ignoring markers
  • Confusing 'fast' with 'slow'
  • Running tests without markers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes