Bird
0
0

Given the following pytest.ini content:

medium📝 Predict Output Q4 of 15
PyTest - Markers
Given the following pytest.ini content:
[markers]
slow = marks tests as slow
fast = marks tests as fast

What happens if you run pytest with a test marked @pytest.mark.slow?
APytest runs the test but shows a warning about the marker
BPytest raises an error about unknown marker 'slow'
CPytest ignores the test marked 'slow'
DPytest runs the test without warnings about the marker
Step-by-Step Solution
Solution:
  1. Step 1: Understand marker registration effect

    Markers 'slow' and 'fast' are registered in pytest.ini, so pytest recognizes them.
  2. Step 2: Predict pytest behavior on marked test

    Since 'slow' is registered, pytest runs the test normally without warnings or errors.
  3. Final Answer:

    Pytest runs the test without warnings about the marker -> Option D
  4. Quick Check:

    Registered marker = no warnings [OK]
Quick Trick: Registered markers run without warnings or errors [OK]
Common Mistakes:
MISTAKES
  • Expecting errors for registered markers
  • Thinking pytest skips tests with markers
  • Confusing warnings with errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes