Pytest is a framework that makes building simple and scalable tests easy. Tests are expressive and readable—no boilerplate code required.
Get started in minutes with a small unit test or complex functional test for your application or library.
Install pytest by following command in terminal:
1 | pip install -U pytest |
Check the installed pytest version:
1 | pytest --version |
Your First Pytest Test
1 2 3 4 5 6 7 8 9 | # content of test_sysexit.py import pytest def f(): raise SystemExit(1) def test_mytest(): with pytest.raises(SystemExit): f() |
Continue reading: https://docs.pytest.org/en/latest/getting-started.html
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.