Because I keep solving the same problems over and over and then I endup trying to remember in which project is the solution located :)
Ran on python 3.9.13 but any python3 should do.
First you need cd to the example that yo want to execute
Create a virtual environment
- mac/linux
python3 -m venv .venv - windows
python -m venv .venv
Activate venv
- mac/linux
source .venv/bin/activate - windows
.\venv\Scripts\activate
Install depedencies (on activated venv)
- Either
python -m pip install -r requirements.in - Or
python -m pip install -r requirements.txtif I did put those in :D
Given a mocked object assert that it has many calls (in any order)
This examples targets command lines tools and shows how to enable a flag for verbose output of the error in the tool
Simple patching of modules during test
When the same method is supposed to return different things, one can patch it with iterable and allow each call to return something else
Example of a fixture that you insert into conftest.py that allows you to patch the database used by SUT for a different - test one.