~/talk

How to build a unit testing library from scratch?

Talkat PyCon AU 2023 · 2023-08-18..08-22· [testing, developer-experience]
links:none on file
slides:none on file

Builds a minimal testing library in Python that reproduces pytest features: a test runner that discovers and calls test functions with try/except and simple reporting, a raises context manager implemented via __enter__/__exit__, a parameterize decorator that loops subtests, and fixtures including yielding fixtures detected by checking for generators. Notes that pytest itself is ~130k lines with ~5,000 PRs; implements decorators, context managers, eval, generators and live-codes fixes — the demo mostly works after iterative bug fixes and prints tracebacks.

AI-written summary · about

  1. 0:00Introduction
  2. 1:05Build your own library
  3. 3:33Reverse engineering pytest
  4. 4:37Building the test runner
  5. 8:30Expected exceptions with raises
  6. 11:43Parameterized test cases
  7. 14:54Designing fixtures
  8. 20:57Debugging fixtures
  9. 22:53Final demo and next steps
  10. 23:56Q&A
~/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.