More on Python testing
In addition to the built-in library of unittest
, there are lots of other Python testing frameworks in the community. Pytest is another robust Python testing framework that is worth a look. pytest
can be used for all types and levels of software testing. It can be used by developers, QA engineers, individuals practicing Test-Driven Development, and open source projects. Many of the large-scale open source projects have switched from unittest
or nose
to pytest
, including Mozilla and Dropbox. The main attractive features of pytest
were a third-party plugin model, a simple fixture model, and assert rewriting.
Note
If you want to learn more about the pytest
framework, I would highly recommend Python Testing with PyTest by Brian Okken (ISBN 978-1-68050-240-4). Another great source is the pytest
documentation: https://docs.pytest.org/en/latest/.
pytest
is command-line-driven; it can find the tests we have written automatically and run them:
$ sudo pip install pytest $ sudo...