Bird
0
0

If pytest.ini does NOT register a marker named database, what will pytest do when it encounters @pytest.mark.database in a test?

medium📝 Predict Output Q5 of 15
PyTest - Markers
If pytest.ini does NOT register a marker named database, what will pytest do when it encounters @pytest.mark.database in a test?
ARaise a syntax error and stop testing
BShow a warning about unknown marker but still run the test
CIgnore the test silently
DAutomatically register the marker and run the test
Step-by-Step Solution
Solution:
  1. Step 1: Understand pytest behavior for unregistered markers

    Pytest warns about unknown markers but does not stop test execution.
  2. Step 2: Confirm pytest does not auto-register markers

    Markers must be registered manually; pytest won't auto-register them.
  3. Final Answer:

    Show a warning about unknown marker but still run the test -> Option B
  4. Quick Check:

    Unregistered marker = warning, test runs [OK]
Quick Trick: Unregistered markers cause warnings but tests still run [OK]
Common Mistakes:
MISTAKES
  • Expecting pytest to stop with error
  • Thinking pytest auto-registers markers
  • Assuming tests are skipped silently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes