A clinic on using factory boy for creating objects, testing and using pytest parameterize to test multiple cases.
While this repo accompanies the PDM 21st Feb 2023 Code clinic it can easily stand alone and be completed without watching that session.
Review the code and pay special attention to the tests directory where we:
- build some factories using factory boy
- use fake data provided by Faker
- & create some parameterized tests using pytest
- code challenge in test_accounts_and_profiles.py file to test your parameterization skills.
- Type checking: for cleaner code (basic)
- pytest_factory boy extension: to register factories in pytest
- pip-compile: simple dependency mgmt
- ipython: pdb on steriods
ipython # https://ipython.org/ ipdb # https://pypi.org/project/ipdb/ factory-boy # https://factoryboy.readthedocs.io/en/latest/ faker # https://faker.readthedocs.io/en/master/ pytest-factoryboy # https://pypi.org/project/pytest-factoryboy/