Python Testing with pytest: pytest now requires markers to be declared (downloadable code)

Many tasks_proj/tests directories exist in chapters 2, 3, 5 that have tests that use the custom markers smoke and get, which are not declared in a pytest.ini file. This was allowed when the book was published. But recent versions of pytest will issue a warning with undeclared markers.

To fix the warning, add this small pytest.ini file to any tests directory that’s causing a problem:

[pytest]
markers =
    smoke
    get
2 Likes