Bird
0
0

Which of the following is a valid reason to use @pytest.mark.skip(reason="...")?

easy🧠 Conceptual Q2 of 15
PyTest - Markers
Which of the following is a valid reason to use @pytest.mark.skip(reason="...")?
AThe test is expected to fail due to a bug
BThe test should run only on Windows
CThe test is flaky and needs fixing later
DThe test requires user input
Step-by-Step Solution
Solution:
  1. Step 1: Identify valid skip reasons

    Tests can be skipped if they are flaky, broken, or temporarily disabled, with a reason explaining why.
  2. Step 2: Differentiate from other markers

    Conditional runs (like only on Windows) use skipif, and expected failures use xfail.
  3. Final Answer:

    The test is flaky and needs fixing later -> Option C
  4. Quick Check:

    Skip reason explains temporary skip = A [OK]
Quick Trick: Use skip for temporary disables, not conditional runs [OK]
Common Mistakes:
MISTAKES
  • Using skip for conditional platform tests
  • Confusing skip with xfail for bugs
  • Not providing a reason for skip
  • Skipping tests that should be fixed immediately

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes