Hello.
I will write down what I have learned about Pytest so far.
It is to help myself, hopefully others think it is useful in some way and I am also trying to fill in the gap between the often over simple basic examples and the advanced ones.
I miss the “intermediate” level.
Please have in mind, English is not my native language
The basic folder structure looks like this
src/
basic_math.py
tests/
__init__.py
test_basic_math.py
The init file can be empty.
But it is needed for pytest to find files on import.
If you have a lot of files in src/ and want to organise the tests for them you can create subfolders in the tests folder.
src/
basic_math.py
advanced_math.py
geometry.py
tests/
# a bit of correction here.
# the __init__.py file has to be in every folder that have a test_something.py
test_basic_math/
__init__.py
test_basic.py
test_adv_math/
__init__.py
test_adv.py
test_geometry/
__init__.py
test_geometry.py
This is one way to keep some kind of order in the project.
To be continued.