Skip to content

Testing and Coverage

SamJenkins1 edited this page Feb 2, 2022 · 1 revision

HLM_PV_Import makes use of pythons unittest, and coverage modules for unit testing. When running tests ensure that you are running within the virtual environment by running ./venv\Scripts\activate.ps1 from within powershell or pycharm in the working directory. To run all tests use python -m unittest discover -s tests\ in the working directory, or to run individual suites use python -m unittest tests\<test_file.py>.

To check coverage instead use coverage run -m unittest discover -s tests\ or coverage run -m unittest tests\<test_file.py>. After these have been run use coverage report -m to generate a report, and coverage html to make the report into a more easily viewable format.

Common issue, powershell and pycharms auto-complete will attempt to use .\tests\<test_file.py>, adding the .\ at the begining of the path when running coverage and unittest will cause the tests to fail.

Clone this wiki locally