Skip to content
← All tracks

Tests That Earn Their Keep

Python

pytest layout, fixtures, parametrisation, injection over patching, property-based testing and typed test suites.

This track is written for Python, which isn't the mode you're browsing in.

0 / 8 solved · 11 articles
  1. 1. pytest Project Layout: conftest, rootdir, Import Modes Read
  2. 2. pytest 9 Configuration and Unified Strict Mode Read
  3. 3. Fixtures: Scope, Teardown, Factories, Autouse Read
  4. 4. Not solved yet. Fixture setup and teardown order
  5. 5. Why Constructor Injection Beats mock.patch Read
  6. 6. Not solved yet. A rate limiter with an injected clock
  7. 7. parametrize: Tables of Cases Instead of Loops of Asserts Read
  8. 8. Not solved yet. Reimplementing pytest's parametrize expansion
  9. 9. Property-Based Testing: Naming the Thing That Is Always True Read
  10. 10. Not solved yet. Four properties for one codec
  11. 11. Stateful Testing: Letting the Machine Find the Sequence Read
  12. 12. Not solved yet. Minimal counterexamples for an LRU cache
  13. 13. Not solved yet. Mutation testing: scoring a test suite
  14. 14. Typing Your Test Suite Under --strict Read
  15. 15. Not solved yet. A typed factory fixture
  16. 16. Deterministic Tests for Concurrency Read
  17. 17. Not solved yet. Detecting leaked tasks and forcing a race
  18. 18. What to Test and What Not To Read
  19. 19. S101 and Per-File Rule Scoping Read

Check yourself

4 questions · one attempt each

These do not count toward finishing the track. They are here to catch the things that are easy to read past.

0 / 4

Two tests pass alone but fail when run together. What is the usual cause?

CACHE = {}          # module level

def test_a(): CACHE['k'] = 1; ...
def test_b(): assert 'k' not in CACHE
Question 1 of 4