-
Notifications
You must be signed in to change notification settings - Fork 1
Tests
Enric Ribera Borrell edited this page Apr 15, 2021
·
10 revisions
- pytest package: https://docs.pytest.org/en/latest/
- how to work with fixtures: https://docs.pytest.org/en/latest/fixture.html#fixtures
- skip tests (useful while the developement): http://doc.pytest.org/en/latest/skipping.html
- run the tests for different python versions: https://pypi.org/project/tox/
- good practices: https://docs.pytest.org/en/latest/goodpractices.html#use-tox
# install pytest
pip install pytest
# load test data
pip install pytest-datadir
# run all tests
pytest
# run all tests + set state space dimension
pytest --dim-state-space 1000
# run all tests and set period length with
pytest --period-length 5
# run tests and set length of finite-time interval
pytest ----interval-length 5
# run all tests from test_stationary.py module
pytest tests/test_stationary.py
# run a specific test from the test_stationary.py module
pytest tests/test_stationary.py::TestStationary::test_current
# to test against the small network example
pytest --small-network
# print test executing times
pytest --durations=0
# print stdout in tests (disable all capturing)
pytest -s