~/talk

Adopt-a-pytest

Talkat PyOhio 2019 · 2019-07-27..07-28· [testing, python]
slides:none on file

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

  1. 0:00Start
  2. 5:04What's a pytest?
  3. 15:28Retrofitting is hard
  4. 16:27Install pytest
  5. 16:51Run pytest
  6. 22:13Shim things
  7. 23:44Use pytest in new tests
  8. 24:09Rewrite old tests
  9. 24:19Use helpful plugins
  10. 24:39Integrate with CI/CO
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.