~/talk

Database Testing with pytest

Talkat PyGotham 2018 · 2018-10-05..10-06· [testing, databases]
name:Dan Clark
links:none on file
slides:none on file

Shows a reproducible pytest setup that tests real Microsoft SQL Server objects using pyodbc connections, fixtures placed in conftest.py, and transaction rollbacks to reset state. Demonstrates unit tests for tables, a view and a stored procedure (including a 4,000‑line SP), finds a miscalculated cost (test saw $100 instead of expected $200) and a bad join that returned 16 rows instead of 8, and fixes both so tests pass. Uses fixture scopes (scope='module') and yield for setup/teardown.

AI-written summary · about

  1. 0:00Introduction
  2. 0:39Accidental DBA journey
  3. 2:11Unit testing basics
  4. 3:24Why pytest
  5. 4:47Testing approach & setup
  6. 6:15Pytest fixtures
  7. 7:43Writing test cases
  8. 8:49Helpful pytest options
  9. 10:21Building fixtures
  10. 12:33Managing scope & files
  11. 13:57Populating test data
  12. 15:06Example test suite
  13. 16:32Handling test failures
  14. 17:41Verification & success
  15. 20:14Pros and cons
  16. 22:47Q&A and conclusion
~/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.