Skip to content

Testing

Jeff Flatten edited this page Mar 29, 2024 · 7 revisions

tmol uses the pytest testing framework.

Running tests

Running all tests

pytest -v --durations=25 --cov=./tmol --junitxml=testing.cpu.junit.xml

Running a specific test

pytest tmol/tests/path/to/your_test_file.py -s -k test_name_substring

Note

-s keeps pytest from capturing your stdout stream, so that you can see any debug print statements that you might have put in. -k runs tests within the file that contain the substring that follows. Use this if you want to only run a specific test

Running the benchmark tests

Writing Tests

Tests are contained in the tmol/tests/ subdirectory. Edit or create a file to add your tests.

The actual tests are functions in these files that start with 'test_'. Pytest will consider any functions with this prefix as tests, including functions inside class definitions.

Pytest 'fixtures' can be used to supply input to your tests. For example, the included 'ubq_res' fixture gives you access to the ubiquitin PDB, and the 'default_database' fixture gives you the tmol database.

Codecov

Clone this wiki locally