Bird
0
0

What is the purpose of registering markers in the pytest.ini file?

easy🧠 Conceptual Q1 of 15
PyTest - Markers
What is the purpose of registering markers in the pytest.ini file?
ATo declare custom markers so pytest recognizes and avoids warnings
BTo define test case names automatically
CTo set the Python interpreter version for pytest
DTo configure the test output format
Step-by-Step Solution
Solution:
  1. Step 1: Understand marker registration role

    Markers are labels for tests. Registering them in pytest.ini tells pytest these are valid custom markers.
  2. Step 2: Recognize effect of registration

    Without registration, pytest warns about unknown markers. Registration avoids these warnings and documents markers.
  3. Final Answer:

    To declare custom markers so pytest recognizes and avoids warnings -> Option A
  4. Quick Check:

    Marker registration = Avoid warnings [OK]
Quick Trick: Register markers in pytest.ini to avoid unknown marker warnings [OK]
Common Mistakes:
MISTAKES
  • Confusing marker registration with test naming
  • Thinking pytest.ini sets Python version
  • Assuming pytest.ini controls output format

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes