Bird
0
0

What will be the output when running this pytest code?

medium📝 Predict Output Q13 of 15
PyTest - Markers
What will be the output when running this pytest code?
import pytest

@pytest.mark.skip(reason="Feature not ready")
def test_feature():
    assert 1 == 1


def test_other():
    assert 2 == 2
ABoth tests run and pass.
Btest_feature is skipped with reason; test_other runs and passes.
CBoth tests are skipped.
Dtest_feature fails; test_other passes.
Step-by-Step Solution
Solution:
  1. Step 1: Identify skipped test

    The decorator skips test_feature with the given reason, so it does not run.
  2. Step 2: Check other test behavior

    test_other has no skip decorator, so it runs and passes.
  3. Final Answer:

    test_feature is skipped with reason; test_other runs and passes. -> Option B
  4. Quick Check:

    Skipped test does not run; others run normally [OK]
Quick Trick: Skipped tests do not run but appear in reports [OK]
Common Mistakes:
MISTAKES
  • Assuming skipped tests run
  • Thinking all tests skip if one is skipped
  • Confusing skip with fail

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes