Here is where I'm starting my journey in developing tests for my codes and the main objective is gain the foundations to develop tests to Machine Learning API's. So, in this repository we can find two folders: Pytest_Book and Pytest_ML. The first one follows the book: "Python Testing with pytest: Simple, Rapid, Effective, and Scalable" and the second have examples of my own research based in internet about this subject.
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries.
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.
What You Need:
The examples of the book are written using Python 3.6 and pytest 3.0. However, pytest 3.0 supports Python 2.6, 2.7, and Python 3.3-3.6. In my case I used the IntelliJ to follow the book.
You should use pip to install pytest and pytest plugins.
If you want to have a brief introduction click here.
Some more cool videos about pytest:
-
Python testing 101 with pytest. The entired code you can find here.