Bird
0
0

You added the following to your pytest.ini but still get warnings about unknown marker 'api':

medium📝 Debug Q6 of 15
PyTest - Markers
You added the following to your pytest.ini but still get warnings about unknown marker 'api':
[markers]
api = marks tests as api

What is the most likely cause?
AMarkers must be registered in <code>conftest.py</code> instead
BThe marker name should be capitalized
CThe <code>pytest.ini</code> file is not in the test root directory
DThe marker description is missing
Step-by-Step Solution
Solution:
  1. Step 1: Check pytest.ini location importance

    Pytest reads pytest.ini only if it is in the root directory or above the tests.
  2. Step 2: Evaluate other options

    Marker names are case-sensitive but lowercase is valid. Registration in conftest.py is optional. Description can be empty but recommended.
  3. Final Answer:

    The pytest.ini file is not in the test root directory -> Option C
  4. Quick Check:

    pytest.ini location = no warnings [OK]
Quick Trick: Place pytest.ini in test root to register markers properly [OK]
Common Mistakes:
MISTAKES
  • Assuming marker names must be capitalized
  • Thinking markers must be registered in code
  • Ignoring pytest.ini file location

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes