small medium large xlarge

Python Testing with pytest: Simple, Rapid, Effective, and Scalable

September 13, 2017

Developing news: on this day in 1898, Hannibal Goodwin patented celluloid photographic film.

Python news: Do less work when testing your Python code, but be just as expressive, just as elegant, and just as readable, with Python Testing with pytest: Simple, Rapid, Effective, and Scalable, now in print and shipping from

Come and get it!

Python Testing with pytest: Simple, Rapid, Effective, and Scalable

For Python-based projects, pytest is the undeniable choice to test your code if you're looking for a full-featured, API-independent, flexible, and extensible testing framework. With a full-bodied fixture model that is unmatched in any other tool, the pytest framework gives you powerful features such as assert rewriting and plug-in capability—with no boilerplate code.

With simple step-by-step instructions and sample code, this book gets you up to speed quickly on this easy-to-learn and robust tool. Write short, maintainable tests that elegantly express what you're testing. Add powerful testing features and still speed up test times by distributing tests across multiple processors and running tests in parallel. Use the built-in assert statements to reduce false test failures by separating setup and test failures. Test error conditions and corner cases with expected exception testing, and use one test to run many test cases with parameterized testing. Extend pytest with plugins, connect it to continuous integration systems, and use it in tandem with tox, mock, coverage, unittest, and doctest.

Write simple, maintainable tests that elegantly express what you're testing and why.

Now in print and shipping from

Upcoming Author Appearances

  • 2017-09-13 Diana Larsen,
    Agile Brazil 2018, Belém, Para, Brasil
  • 2017-09-22 Rachel Davies,
    Agile Greece Summit, Athens
  • 2017-09-26 Diana Larsen,
    UX Strategy Day Zürich, Zürich, CH
  • 2017-09-28 Alex Miller,
    Strange Loop, St. Louis, MO
  • 2017-10-01 VM Brasseur,
    Velocity NYC
  • 2017-10-05 Rachel Davies,
    Software Craftsmanship, London
  • 2017-10-06 VM Brasseur,
    SeaGL 2017
  • 2017-10-07 Randall Koutnik,
    Silicon Valley Code Camp
  • 2017-10-09 Ian Dees,
    Pacific Northwest Software Quality Conference (PNSQC), Portland, OR
  • 2017-10-23 VM Brasseur,
    All Things Open 2017
  • 2017-10-27 Chris Adamson,
    Swift by Northwest
  • 2017-10-29 VM Brasseur,
    LISA 2017
  • Don't Get Left Out

    Are your friends jealous that you get these spiffy email newsletters and they don't? Clue them in that all they need to do is create an account on (email address and password is all it takes) and select the checkbox to receive newsletters.

    Are you following us on Twitter and/or Facebook? Here's where you can find us and keep up with the latest news and commentary, and occasional discounts:

    Tell your friends! Tweet this

    Follow us on Twitter: pragprog</a>, <a href="">pragpub, Andy Hunt @PragmaticAndy.

    Coming Soon:

    • Adopting Elixir: From Concept to Production
    • Liftoff (audio book)
    • Programming Crystal: Fast as C, Slick as Ruby
    • Reactive Programming with RxJS 5: Untangle Your Asynchronous JavaScript Code
    • Complex Network Analysis in Python

    Recently Released:

    Thanks for your continued support,

    Andy Hunt
    Publisher, Pragmatic Bookshelf

    Books • eBooks • PragPub Magazine • Audiobooks and Screencasts