/awesome-pytest

A curated list of awesome pytest resources

Awesome pytest Awesome

Videos

Michael Tom-Wing, Christie Wilson - Introduction to Unit Testing in Python with Pytest - PyCon 2016

Why I use py.test and maybe you should too

Python Code Review: Adding Pytest Tests to an Existing Python Web Scraper

Holger Krekel - pytest - rapid and simple testing with Python

Articles

Effective Python Testing With Pytest

Python unit testing with Pytest and Mock

The Cleaning Hand of Pytest

Django Test Driven Development with Pytest

Python Unit Testing(Pytest)

Creating a PySpark project with pytest, pyenv, and egg files

Unit testing Apache Spark with py.test

Testing sys.exit() with pytest

Passing fixtures to tests in pytest

Django + Mongo = Pytest FTW! A clean way to manage connecting and dropping of database between tests

Pytest-mock. How to mock your database connection

How to use pytest fixtures in Django testing

Testing Python Applications with Pytest

Pytest-Tricks

How to modularize your py.test fixtures

How to write parametrized tests using pytest

Presentations

Adopt-a-pytest - slides

pytest for unittest users

Introduction to pytest - Andreas Pelme - Euro Python 2014

Pytest recommendations and basic packages for testing in Python and Django - Andreu Vallbona - PyBCN June 2019

Code samples and projects

Requests - Python HTTP Requests for Humans™ and Pytest

Plugins

Plugin List - PyPI projects that match “pytest-*” are considered plugins and are listed automatically. Packages classified as inactive are excluded. This list contains 865 plugins.

pytest-bdd - pytest-bdd implements a subset of the Gherkin language to enable automating project requirements testing and to facilitate behavioral driven development.

pytest-checkipdb - Plugin to check if there are ipdb/pdb/breakpoint breakpoints left into our code

pytest-clarity - A plugin to improve the readability of pytest output.

pytest-codeblocks - Tests code blocks in your READMEs.

pytest-cov - This plugin produces coverage reports

pytest-datadir - pytest plugin for manipulating test data directories and files

pytest-deadfixtures - A simple plugin to list unused or duplicated fixtures in a pytest suite.

pytest-embrace - Dataclasses-as-tests. Describe the runtime once and multiply coverage with no boilerplate.

pytest-flake8 - pytest plugin for efficiently checking PEP8 compliance

pytest-django - pytest-django is a plugin for pytest that provides a set of useful tools for testing Django applications and projects.

pytest_docfiles - Test the code sections in your documentation.

pytest-duration-insights - Gives an interactive dashboard to show where the slow tests are.

pytest-fast-first - Run fast tests before slower one.

pytest-flake8 - pytest plugin for efficiently checking PEP8 compliance

pytest-freezegun - Plugin that allows your Python tests to travel through time by mocking the datetime module.

pytest-lazy-fixtures - Use your fixtures in @pytest.mark.parametrize.

pytest-mimesis - Mimesis integration with the pytest test runner. Generate fake data in your tests.

pytest-modified-env - Pytest plugin to fail a test if it leaves modified os.environ afterwards.

pytest-monitor - Pytest-monitor is a pytest plugin designed for analyzing resource usage.

pytest-picked - Run tests related to changes detected by version control (e.g. run all tests in test files with unstaged changes).

pytest-randomly - Pytest plugin to randomly order tests and control random.seed. By randomly ordering the tests, the risk of surprising inter-test dependencies is reduced.

pytest-repeat - A plugin for pytest that makes it easy to repeat a single test, or multiple tests, a specific number of times.

pytest-reportlog - Report logs into a file as the test session executes.

pytest-reverse - Pytest plugin to reverse test order.

pytest-spec - pytest plugin to display test execution output like a SPECIFICATION.

pytest-sugar - pytest-sugar changes the look and feel of pytest by adding a progressbar and instafailing tests.

pytest-testmon - Selects tests affected by changed files. Continous test runner when used with pytest-watch.

pytest-pinned - A simple pytest plugin for writing pinning tests. Pinning tests, snapshot tests or characterization tests are meant to describe (characterize) the actual behavior of an existing piece of software, and therefore protect existing behavior against unintended changes via automated testing.

pytest_profiles - Lets you create configuration profiles for pytest.

pytest-profiling - Profiling plugin for pytest, with tabular and heat graph output.

pytest-testinfra - Infrastructure testing to validate the actual state of your servers configured by management tools like Salt, Ansible, Puppet, Chef and so on.

pytest-unordered - Test collection content, ignoring order.

pytest-watch - Watches files and runs tests whenever a file is changed.

pytest-xdist - pytest plugin for distributed testing and loop-on-failures testing modes.

pytest-modified-env - Pytest plugin to fail a test if it leaves modified os.environ afterwards.

pytest-unordered - Test collection content, ignoring order.

Courses

Test-Driven Development with Python, Flask, and Docker

Calmcode - Intro to Testing with Pytest

Books

Python Testing with pytest by Brian Okken - The Pragmatic Programmers (publisher)

pytest Quick Start Guide by Bruno Oliveira - Packt (publisher)