Bird
0
0

Why is it important to register custom markers in pytest.ini when using -m to run tests?

hard🧠 Conceptual Q10 of 15
PyTest - Markers
Why is it important to register custom markers in pytest.ini when using -m to run tests?
ATo enable parallel test runs
BTo speed up test execution
CTo automatically generate test reports
DTo avoid warnings and errors about unknown markers
Step-by-Step Solution
Solution:
  1. Step 1: Understand pytest marker registration

    pytest requires custom markers to be declared in pytest.ini to recognize them properly.
  2. Step 2: Consequences of missing registration

    Without registration, pytest shows warnings or errors when running tests with those markers.
  3. Final Answer:

    To avoid warnings and errors about unknown markers -> Option D
  4. Quick Check:

    Register markers to prevent unknown marker errors [OK]
Quick Trick: Register markers in pytest.ini to prevent errors [OK]
Common Mistakes:
MISTAKES
  • Thinking registration improves speed
  • Assuming registration generates reports
  • Confusing marker registration with parallelism

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes