Contribute Media
A thank you to everyone who makes this possible: Read More



pytest is a testing framework that makes writing and running Python tests simpler. Adopting new tooling in a large system is often a burden. How can you introduce pytest gradually with minimal pain?


This is for anyone currently using unittest for Python unit testing that would like to adopt pytest.


  • How to run pytest
  • How to create a basic pytest configuration
  • Using pytest marks to shim an existing project
  • Converting a unittest test to pytest


With its simplified syntax, powerful fixture behaviors, detailed test reports, and plugin-based architecture, pytest has a lot to offer. Whether you're new to Python unit testing or you've been using unittest for a while, pytest may be something to consider. It's not too hard to get up and running with pytest on a fresh project, but how can you retrofit an existing project without having to refactor the world all at once?


Improve this page