Recall & Review
beginner
What is the purpose of registering markers in pytest.ini?
Registering markers in pytest.ini helps pytest recognize custom markers, avoid warnings, and organize tests by categories or features.
Click to reveal answer
beginner
How do you register a custom marker named
slow in pytest.ini?Add the following under the [pytest] section:<br>
[pytest]
markers =
slow: marks tests as slow to runClick to reveal answer
intermediate
Why should you register markers instead of just using them directly in test code?
If markers are not registered, pytest shows warnings during test runs. Registering markers documents their purpose and improves test clarity.
Click to reveal answer
intermediate
What is the syntax to register multiple markers in pytest.ini?
List each marker on a new line under the
markers key:<br>[pytest]
markers =
slow: marks tests as slow
smoke: marks smoke tests
api: marks API testsClick to reveal answer
beginner
Where should the pytest.ini file be placed in your project?
Place pytest.ini in the root folder of your project so pytest can find it automatically when running tests.
Click to reveal answer
What happens if you use a custom marker in pytest without registering it in pytest.ini?
✗ Incorrect
Pytest runs the tests but warns that the marker is unknown, encouraging you to register it.
How do you define a marker description in pytest.ini?
✗ Incorrect
The correct syntax is under [pytest] section with 'markers =' followed by lines like 'marker_name: description'.
Where in the pytest.ini file do you register markers?
✗ Incorrect
Markers are registered under the [pytest] section in pytest.ini.
Which of these is a valid marker registration in pytest.ini?
✗ Incorrect
The correct format is under [pytest] with 'markers =' and each marker on a new indented line.
Why is it helpful to register markers in pytest.ini?
✗ Incorrect
Registering markers avoids warnings and helps document what each marker means.
Explain how to register a custom marker in pytest.ini and why it is important.
Think about the file structure and the syntax needed to tell pytest about your marker.
You got /6 concepts.
Describe the consequences of not registering markers in pytest.ini when using them in your tests.
Consider what pytest does when it sees a marker it does not recognize.
You got /4 concepts.