Pytest Master Class Full Course
Learn to master testing in Python with Pytest from Five Time O'Reilly Author and AWS ML Hero Noah Gift
Pytest is a testing framework for Python that allows you to write tests in a readable and concise way.
This close to three-hour course will teach you how to write tests in Python using Pytest as well as master CI/CD with Pytest.
Take your testing and DevOps skills to the next level with this full-course Pytest Master Class.
Topics Covered Include:
- 00:00 Introduction
- 03:38 What is DevOps?
- 05:32 Github CodeSpaces
- 09:45 Create Python Project Structure: Makefile, requirements.txt, test file and virtualenv
- 16:33 Importing code with IPython
- 17:32 Writing tests with Pytest
- 21:58 Using Pylint
- 23:56 Verifying Pylint bad syntax catch
- 25:41 Formatting code with Black
- 26:38 Pinning requirements to a specific version
- 30:00 Setup Github Actions
- 37:38 Matrix Testing multiple versions of a Python 3.6, 3.7, 3.8, 3.9 with Github Actions
- 50:00 Using AWS CloudShell
- 53:00 Using AWS Cloud9
- 54:07 Adding virtualenv to ~/.bashrc
- 57:24 Using AWS CodeBuild
- 01:17:01 Testing Google Colab Notebooks and Jupyter Notebooks with nbval and Pytest
- 01:29:39 Using pdb;pdb.set_trace() and ipdb;ipdb.set_trace()
- 01:35:53 Using pytest-cov
- 01:37:47 Using pytest with --pdb pdb debbuging during tests
- 01:38:12 Using pytest with --pdb --maxfailures 1 to stop after first failure
- 01:42:20 Using pytest to test a single test
- 01:49:25 Using Pytest with fixtures
- 01:56:23 Using Pytest setup_function and teardown_function to setup and teardown of tests
- 02:00:00 Using flask web framework
- 02:04:25 Testing flask web framework with pytest
- 02:10:46 Extending flask with a greedy coin change machine
- 02:21:27 Using click to create a command line interface
- 02:30:39 Using Pytest to test click command line interfaces
- 02:44:42 Matrix testing entire project with click, pytest, and nbval using Github Actions and multiple versions of Python 3.6, 3.7, 3.8, 3.9
Learning Objectives
This course covers the following learning objectives:
- Learn to master Pytest.
- Learn to setup CI/CD pipelines with Pytest, Pylint, Python Black Formatting, Github Actions and AWS CodeBuild.
- Learn to use Cloud-based development environments with Pytest like Githhub CodeSpaces, AWS Cloud9 and AWS CloudShell
- Learn to create local test environments with Pytest and Virtualenv
- Learn to use advanced functions like Pytest test selection, pdb (python debugger) and fixtures.
- Learn to build a realistic problem including libraries, building command-line tools with Click and web frameworks with Flask.
Additional Popular Resources