~/talk

Testing the Database Layer: typical problems & best practices

Talkat PyOhio 2015 · 2015-08-01..08-02· [testing, databases]
links:none on file
slides:none on file

Practical guide to testing the database layer for Python web apps: assumes you keep a real DB (does not mock it), recreates schema at test start, and enforces SQLAlchemy entity conventions (id, created/updated UTC timestamps, FK checks) via an entity base. Uses pytest, a wheelhouse for reproducible deps, and a lightweight testing_create factory system instead of brittle fixtures. Real-world scale: ~5,000 tests over 207 tables, ~24 minutes full run; introspection replaces many DB round trips and migrations are tested in phased steps.

AI-written summary · about

  1. 0:00Intro
  2. 0:11Let's Talk
  3. 2:21Background & Assumptions
  4. 4:21Why Database Testing Is Hard
  5. 8:26Tests as Assets
  6. 11:38Easy Setup
  7. 12:04No Hassle Clone to Testing
  8. 14:45Consistency
  9. 16:57Idempotent: Test Prep
  10. 26:13Data Creation
  11. 38:53Patterns to Enforce
  12. 41:59Speed: As Fast as Reasonable
  13. 46:56Migration: Testing Workflow
~/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.