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.

There is also a repo and video series on YoYo database migrations and SQL Schema Tests here https://pytest-cookbook.com/toolbox/docker_postgres_yoyo_pytest/.

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.

60 pwe

Using the awesome resource https://pytest-with-eric.com/, I have started to create videos of me working through Eric's articles and integrating them into PFS.

Docker

These are tests that use/test Docker implementations. Alas, my favoured numbering system was not possible due to erroring, but is section 70.