Criteria for good enough tests

As much as possible

  • Use pytest to make your testing life easier.
  • Generalize your tests using hypothesis, but if in a pinch, use hard-coded examples and annotate where to generalize later.
  • Tests should run under 500 ms per test, but this is not a hard rule.
  • Hit as many lines of code as you can, but don't rely on test coverage to be satisfied with a test.
  • Use your tests to re-design code to be easier to use, and hence, test.