Skip to content

Tests

00 check_setup

These are used to test that:

  • src and tests are wired correctly
  • read config.ini in the config folder
  • logging works and outputs to log/pytesting.log
  • test a sample mock works

01 Inspect

Using SQLModel's inspect, we run tests on SQL schema to verify foreign keys, check constraints etc exist. Inspired by Very Academy's TDD Fast Api course.

02 CoffeeBeforeArch

Located in 02_py_coffee in PFS, this is a great video series on PyTest. I have included the tests form his repo as part of the template tests. Links in repo.

CoffeeBeforeArch

03 Indian Pythonista

Located in 03_indian_pythonista in PFS, this is another great video series that has source code included.

Indian Pythonista

05 mocks_patch

A large number of templated mocks and patches, with extensive code comments. I have adapted them as necessary and the links to the YouTube videos are included.

Some did not have source code so I transcribed the code from the videos.

10 py_api_pets

Using Playwright, the full CRUD api tests to https://petstore.swagger.io/v2/pet/ is included providing templates for API testing.

20 playwright

A great range of End2End tests from a variety of sources.

50 pwe_bdd

A working example of using the pyTest-bdd, based on the awesome resource https://pytest-with-eric.com/ which is perhaps the best resource on PyTest available.

In time, more templates will be added, hevily commented to aid understanding and with videos as and when possible.