This list contains a bunch of links to pytest resources that should be valuable to beginners as well as intermediates or more senior folks.
- Python Testing with pytest 2nd Edition (Brian Okken): Really comprehensive in-depth book that covers all the basics not only in theory but also has many
step-by-step working examples. Brian has also released a accompanying course that is also linked below. But this book
is definitely a great starting point to learn how
pytest
works.
- Official pytest docs: This is the official pytest documentation site which should give you
everything you need to know to install and configure pytest on your machine. You'll also find a bunch of guides for
specific reference topics and how-to start guides:
- Fixtures Reference
- Configuration
- Talks and Tutorials: Officially maintained list of talks and tutorials.
- PyCon / EuroPython
- Pandy Knight: def test_crash_course_with_pytest(): This recording
of a workshop session from Pycon US 2024 really matches its title. Pandy Knight gives a really comprehensive crash
course to
pytest
covering all the relevant topics on not only how pytest works but also on how to use it professionally. - Florian Bruhin: pytest - simple, rapid and fun testing with Python (3 hours): Content-wise pretty similar to Pandy Knight's crash course but presented in a different style (the dude is one of pytest's maintainers).
- Pandy Knight: def test_crash_course_with_pytest(): This recording
of a workshop session from Pycon US 2024 really matches its title. Pandy Knight gives a really comprehensive crash
course to
- Brian Okken's - The Complete pytest Course (Companion to the Python Testing with pytest book): This online course accompanies the book mentioned at the beginning. While I haven't started it yet, Brian's work (e.g., his writings) is typically of high quality.
- calmcode.io: calmcode is a treasure trove of small, comprehensive, to-the-point mini-courses on a variety of Python topics. They offer two short, worthwhile courses on pytest:
- Brian Okken's blog about pytest: Authored by the writer of the aforementioned book and course.
- Pytest With Eric: This blog lives up to its URL, covering a variety of pytest-related topics in an easy-to-digest writing style. It features both in-depth explorations of specific topics and broader, more general subjects:
- Python Testing 101 (How To Decide What To Test)
- How To Practice Test-Driven Development In Python? (Deep Dive)
- How To Mock in Pytest? (A Comprehensive Guide)
- What Are Pytest Mock Assert Called Methods and How To Leverage Them
- A Step-by-Step Guide To Using Pytest Fixtures With Arguments?
- Mocking Vs. Patching (A Quick Guide For Beginners)
- Introduction To Pytest Hooks (A Practical Guide For Beginners)
- 5 Easy Ways To Read JSON Input Data In Pytest
- A Simple Guide To Controlling Time in Pytest Using Freezegun
- How To Ignore Warnings In Pytest (With Examples)
- The Ultimate Guide To Capturing Stdout/Stderr Output In Pytest
- How To Test CLI Applications With Pytest, Argparse And Typer
- How To Test And Build Python Packages With Pytest, Tox And Poetry
- PyCon / EuroPython
- Raphael Pierzina - Advanced pytest (focused on how to implement/use pytest plugins)
- [PyCon JP 2022] Building Pytest Plugins (Phebe Polk) - References the talk by Raphael Pierzina
- Talks - Dan Craig: Testing Spacecraft with Pytest
- Florian Bruhin: pytest - simple, rapid and fun testing with Python (3 hours)
- "Securing your AWS Identity Management pipeline with PyTest" - Sean Johnson (PyCon AU 2019)
- Arjan Codes
- mCoding
- Cameron Maske