~/talk

Unit Testing with Pytest

TalkinSpanishat PyCon US 2023 · 2023-04-19..04-27· [testing, python]
links:none on file
slides:none on file

Unit testing with pytest: shows how unit tests provide confidence for refactors and document behavior, demonstrates pytest’s precise failure diffs, and recommends stubbing heavy computations to keep tests fast. Uses concrete examples: a make_adict wrapper around code and a slow son_calculation function replaced with mocker.patch(autospec=True) so only wrapper logic is tested; illustrates fixtures returning Person instances, @pytest.mark.parametrize for multiple scenarios, and test selection using pytest -m / -k plus marking slow tests.

AI-written summary · about

  1. 0:00Start
  2. 2:58Why testing brings peace?
  3. 6:24Getting started
  4. 20:29Parametrize
  5. 23:43Marks
  6. 25:27Some tips!
~/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.