Adopt-a-pytest
summary
Steps to migrate a large codebase from unittest to pytest with concrete fixes and results: run existing tests to get a baseline (JSTOR had ~900 modules, ~300 test modules, ~2,000 tests), install pytest and pytest-cov, run pytest and notice 47 tests -> 37 discovered due to discovery patterns, fix with pytest.ini python_files, use pytest-django and a conftest fixture to enable DB access (auto-use then mark only the tests that need DB), extract fixtures to speed slow tests, add pytest plugins and CI reporting; result: tests run automatically on every commit and coverage returns to expected levels.
AI-written summary · about
chapters (10)
- 0:00Start
- 5:04What's a pytest?
- 15:28Retrofitting is hard
- 16:27Install pytest
- 16:51Run pytest
- 22:13Shim things
- 23:44Use pytest in new tests
- 24:09Rewrite old tests
- 24:19Use helpful plugins
- 24:39Integrate with CI/CO
related talks
28mHow I migrated a huge OSS project to use pytest
37mTesting your Plone codebase with Pytest
27mWhy I use py.test and maybe you should too
33mUnit Testing with Pytest
26mMashing up py.test, coverage.py and ast.py to take TDD to a new level
28mEgad! How Do We Start Writing Better Tests?
28m"WHAT IS THIS MESS?" - Writing tests for pre-existing code bases
26mThe realities of open source testing: lessons learned from “Adopt pytest month”
