Bird
0
0

Which of the following is the correct syntax to register a marker named slow in pytest.ini?

easy📝 Syntax Q3 of 15
PyTest - Markers
Which of the following is the correct syntax to register a marker named slow in pytest.ini?
A[markers] slow - marks tests as slow
B[pytest] markers = slow
C[markers] slow: marks tests as slow
D[markers] slow = marks tests as slow
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct marker syntax in pytest.ini

    Markers are registered under [markers] with format: name = description.
  2. Step 2: Validate each option

    [markers] slow = marks tests as slow uses correct '=' syntax. [pytest] markers = slow uses wrong section and format. Options C and D use invalid separators.
  3. Final Answer:

    [markers] slow = marks tests as slow -> Option D
  4. Quick Check:

    Marker syntax = name = description [OK]
Quick Trick: Use '=' to assign marker description under [markers] [OK]
Common Mistakes:
MISTAKES
  • Using ':' or '-' instead of '='
  • Placing markers under [pytest] section
  • Omitting the description after marker name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes