-
Notifications
You must be signed in to change notification settings - Fork 1
Tests
rodrigocam edited this page Mar 22, 2017
·
2 revisions
In this project we will use the tool pytest to run all of our tests.
To install the pytest we are going to use, type at console:
sudo apt install python3-pytest
- Every module (file.py) must have a file named module_name_TEST
- To make a file test, import the module you are testing. Ex: from (module_name) import *
- Every test must be named as test_function/method_name
- To run all tests of a module, type at console:
py.test-3 module_name.py - To run a specific test, type at console:
py.test-3 -k test_name module_name.py - To run all tests bellow some path, type at console:
py.test-3 somepath - To stop after the first failure add the flag -x:
py.test-3 -x module_name.py - To stop after (N) failures add the flag --maxfail=N:
py.test-3 --maxfail=5 module_name.py
More informations at http://doc.pytest.org/en/latest/contents.html
