pytest, virtual environments, project layout, and running the suite on every push.
Before this guide: Python from the Start, and Object-Oriented Python.
The notebooks
Open in Colab runs a notebook in your browser, and Read shows it on GitHub without running it. Every notebook runs on its own, and the answers to its exercises are in a separate notebook, linked as Solutions.
| 1 | Why TestThe bug you are going to reintroduce next week | Open in ColabReadSolutions |
| 2 | Your First Testpytest, plain assert, and running the suite | Open in ColabReadSolutions |
| 3 | Test StructureArrange, act, assert, and one behavior per test | Open in ColabReadSolutions |
| 4 | FixturesSetup without repetition, and scope | Open in ColabReadSolutions |
| 5 | ParametrizeThe same test over many inputs, reported separately | Open in ColabReadSolutions |
| 6 | Testing Failurepytest.raises, and asserting that the right thing went wrong | Open in ColabReadSolutions |
| 7 | Virtual Environmentsvenv, why it exists, and the tutorial that broke without one | Open in ColabReadSolutions |
| 8 | Requirements and PinningRecording an environment somebody else can reproduce | Open in ColabReadSolutions |
| 9 | Project Layoutsrc, imports that work from anywhere, and the editable install | Open in ColabReadSolutions |
| 10 | Continuous IntegrationRunning the suite on every push, and reading a failed run | Open in ColabReadSolutions |