Open biosafetylvl5 opened 3 months ago
From talking with @evrose54, it seems that most of the stochastic tests are gone. The only ones remaining is for testing geoips get plugin
and the geoips validate
. Rather than using a stochastic test for these, I would like to trim down to a single test to start, then use pytest-cov to determine what code is not covered by that single test. Then add additional hard-coded tests to achieve better coverage.
To test coverage and print the lines that are not covered, use pytest --cov --cov-report term-missing
. If you want to call pytest on specific tests, you can specify the file that contains the particular test so you don't have to wait as long when testing your specific unit tests: pytest --cov --cov-report term-missing ./tests/unit_tests/path_to_my_test_file.py
.
Unit tests introduced in #444 are stochastic:
this increases run time performance. Which is very clever!
However, it is best practice that unit tests are repeatable, which this practice undermines.
I suggest using pytest marks instead to allow testers to choose to run the fast but random test suites or the slow but comprehensive tests. With marks, users could run
pytest -m slow
which would run all tests which are decorated with the @pytest.mark.slow decorator.If this is agreed upon as a good idea, I can write out a plan for development.