Automated testing in Python is an important way to take your Python project to the next level of dependability and professionalism. There are a lot of steps, but it's not too difficult to setup your tests to run automatically across multiple different operating systems and versions of Python whenever you push a commit or receive a pull request on your repository. We show you the entire process, step by step, to take a plain old project and turn it into an installable package with automated tests that run when you push to GitHub. We use pytest, mypy, and flake8 for testing, type checking, and code linting. Then we use tox to run all of these commands in isolated virtual environments. Finally, we use GitHub actions to run tox on a push or a pull request. Automated testing is the first and most important step in the more general world of continuous integration (CI), and continuous delivery or continuous deployment (CD). In this video we focus on automated testing, not on general CI/CD, as there is already PLENTY of material to cover.

0:00 Intro
1:21 Overview of the video
2:56 Structuring your project
8:35 Pytest, mypy, flake8
10:58 Pytest features
18:34 Test multiple envs with tox
21:18 Test on commit with GH Actions
25:22 Readme badge
26:34 Thanks

Source code: 
Other code: 
pytest docs: 
mypy docs: 
flake8 docs: 
setuptools (setup py and setup cfg) docs: 
tox docs: 
GitHub Actions docs: 
tox-gh-actions repo: 



How to Automate Your Python Tests with pytest, tox, and GitHub Actions
2 Likes14.25 GEEK