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.

CHAPTERS
---------------------------------------------------
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: https://github.com/mCodingLLC/SlapThatLikeButton-TestingStarterProject 
Other code: https://github.com/mCodingLLC/VideosSampleCode 
pytest docs: https://docs.pytest.org/en/latest/ 
mypy docs: https://mypy.readthedocs.io/en/stable/index.html 
flake8 docs: https://flake8.pycqa.org/en/latest/ 
setuptools (setup py and setup cfg) docs: https://setuptools.readthedocs.io/en/latest/index.html 
tox docs: https://tox.readthedocs.io/en/latest/ 
GitHub Actions docs: https://docs.github.com/en/actions 
tox-gh-actions repo: https://github.com/ymyzk/tox-gh-actions 

Subscribe: https://www.youtube.com/@mCoding/featured 

#python 

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