February 2022
Intermediate to advanced
274 pages
6h 28m
English
Suppose we have a bunch of scripts and a bunch of tests for those scripts, and our directory is getting a bit cluttered. So we decide to move the scripts into a src directory and the tests into a tests directory, like this:
| | script_src |
| | ├── src |
| | │ └── hello.py |
| | ├── tests |
| | │ └── test_hello.py |
| | └── pytest.ini |
Without any other changes, pytest will blow up:
| | $ cd /path/to/code/ch12/script_src |
| | $ pytest --tb=short -c pytest_bad.ini |
| | ========================= test session starts ========================== |
| | collected 0 items / 1 error |
| | |
| | ================================ ERRORS ================================ |
| | _________________ ERROR collecting tests/test_hello.py _________________ ... |
Read now
Unlock full access