PyTest

Basics PyTest basics The first test, the project layout, argument validation and PyCharm setup. Open @fixture Fixtures Setup and teardown around a test, and how far a fixture reaches. Open Parametrize Parametrization One test function, a table of inputs, a separate result for every row. Open conftest conftest.py Fixtures and hooks shared by every test of a folder. Open monkeypatch monkeypatch Change an environment variable or an attribute, then put it back. Open tmp_path tmp_path An empty directory for each test, and a factory for the whole session. Open raises pytest.raises Check that a call fails with the expected exception. Open Errors Errors The messages pytest prints when a test cannot be imported. Open Remote Remote run Run the suite on another machine and read the result over HTTP. Open HTML HTML report A self-contained HTML report of a run, with the failed tests first. Open Allure Allure + PyTest Allure steps, attachments and a report with history. Open Video Video Video lessons about fixtures and the first pytest tests. Open Import Import-time settings A module that reads a setting once, and the reload that makes it testable. Open Paths Log paths Load a module by path and check that a shell helper agrees with it. Open Subset URL selection PATHS_FILE narrows the sitemap tests to a list of paths, read once at import. Open Lock Refresh lock A cron chain that exits 0 when another run already holds its flock lock. Open Since Error report Apache error logs: dates, --since and one capped prod request per fatal page. Open Bots Bot signatures Two one-request signatures that list a scraper the volume rules miss. Open

All articles