- Paperback: 222 pages
- Publisher: Pragmatic Bookshelf; 1 edition (September 25, 2017)
- Language: English
- ISBN-10: 1680502409
- ISBN-13: 978-1680502404
- Product Dimensions: 7.2 x 0.5 x 9 inches
- Shipping Weight: 14.4 ounces (View shipping rates and policies)
- Average Customer Review: 9 customer reviews
- Amazon Best Sellers Rank: #258,897 in Books (See Top 100 in Books)
Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
Python Testing with pytest: Simple, Rapid, Effective, and Scalable 1st Edition
Use the Amazon App to scan ISBNs and compare prices.
Frequently bought together
Customers who bought this item also bought
Customers who viewed this item also viewed
From the Publisher
From the Preface
The use of Python is increasing not only in software development, but also in fields such as data analysis, research science, test and measurement, and other industries. The growth of Python in many critical fields also comes with the desire to properly, effectively, and efficiently put software tests in place to make sure the programs run correctly and produce the correct results. In addition, more and more software projects are embracing continuous integration and including an automated testing phase, as release cycles are shortening and thorough manual testing of increasingly complex projects is just infeasible. Teams need to be able to trust the tests being run by the continuous integration servers to tell them if they can trust their software enough to release it.
What Is pytest?
A robust Python testing tool, pytest can be used for all types and levels of software testing. pytest can be used by development teams, QA teams, independent testing groups, individuals practicing TDD, and open source projects. In fact, projects all over the Internet have switched from unittest or nose to pytest, including Mozilla and Dropbox. Why? Because pytest offers powerful features such as assert rewriting, a third-party plugin model, and a powerful yet simple fixture model that is unmatched in any other testing framework.
pytest is a software test framework, which means pytest is a command-line tool that automatically finds tests you’ve written, runs the tests, and reports the results. It has a library of goodies that you can use in your tests to help you test more effectively. It can be extended by writing plugins or installing third-party plugins. It can be used to test Python distributions. And it integrates easily with other tools like continuous integration and web automation.
I found Python Testing with pytest to be an eminently usable introductory guidebookto the pytest testing framework. It is already paying dividends for me at mycompany.
About the Author
Brian Okken is a lead software engineer with two decades of R&D experience developing test and measurement instruments. He hosts the Test & Code podcast and co-hosts the Python Bytes podcast.
Author interviews, book reviews, editors picks, and more. Read it now
Top customer reviews
There was a problem filtering reviews right now. Please try again later.
If you're a python programmer who knows (a little or a lot of) unit-testing you may want to learn how to better exploit the built-in fixtures and other goodies pytest has to offer. This book should scratch that itch. It stays on topic and talks about making pytest work for python unit-testing - no more, no less; it completely delivers on the promise of the title.
This is a short well-edited book and an easy read. The first 150 pages include a fairly detailed overview and good (short) examples of the various cmd-line switches/options, a good discussion of conftest.py, and the other built-in fixtures. The last 30 pages or so is a series of short appendices about virtual environments, pip, pytest packages, and packaging python code. These are nice adjuncts that can help make your work more useable... and make you look good too. I was glad Brian avoided the subject of mocking, as that warrants either a book section or an entire book and anything less would be unfulfilling and distracting.
Really nice work.
This book got it right. I wanted to "level up" on pytest, without devoting 800 pages, but still something that covered all the topics in enough depth that I could start using those features and even refer back to the book as a reference. With a heavy emphasis on working code, Brian left me in a spot where I was effective at test-writing.
Kudos on the effort to produce variations of working code. I'm in a similar business and understand how hard it is to get that right. I followed the numerous pre-release versions (kudos also on that) and I can only imagine the ongoing maintenance.
Perhaps my only quibbles: a number of times a topic was introduced and then "we'll cover that in Chapter 4". A few times is ok but it got a bit excessive. I would have liked a deeper treatment of mocking, as this is a topic with much subtlety.
Thanks Brian for the hard work.
Let's face it, testing is hard. It is a skill you have to practice and like any other skill you need to learn it first.
Enter Brian Okken's "Python testing with pytest".
It is one of those tech books that are a joy to read. The book is not only informative but well written (and it has one of the loveliest acknowledgements ever).
Despite being relatively short, Python testing with pytest is packed with information.
Okken takes us quickly through the setup, managing to cover the basics of running tests and available options. This alone is enough to give you a feel for pytest.
We are then shown the basics of writing test functions. Okken takes the time to demonstrate some of pytest's best features (marking test function, parameterization, etc.) and makes a point of testing for failure (something a lot of us forget, I think).
The book goes on to discuss fixtures, both built-in and those you write yourself, and configuration, as well as plugins and how to use pytest with other tools.
I honestly think this book made me a little better at testing. Yes, it is about pytest but it presents testing in such a way that my eyes don't glaze over as they sometimes might.
This book is useful for learning the tool and the skill. Highly recommended!