File tree Expand file tree Collapse file tree 3 files changed +31
-27
lines changed Expand file tree Collapse file tree 3 files changed +31
-27
lines changed Original file line number Diff line number Diff line change 3737pdm install
3838```
3939
40- ### perform unit tests:
40+ ### testing
41+
42+ The entire test suite (unit tests & compatibility tests) can be triggered
43+ by running
4144
4245``` SHELL
43- pdm run pytest
46+ scripts/run_tests
4447```
4548
46- ### perform compatibility tests:
49+ You have successfully run all tests when the output ends with :
4750
48- ``` SHELL
49- tox
5051```
52+ ----------------------------------------------------------------------
53+ If you reached this far you passed. Congratulations!
54+ ----------------------------------------------------------------------
55+ ```
56+
57+ If the unit tests have run successfully coverage file in LCOV format is
58+ generated and stored at ` coverage/lcov.info ` . This file can be used by
59+ your IDE to indicate code coverage from within your editor window.
60+ - We recommend the Visual Studio Code extension
61+ [ Code Coverage] ( https://marketplace.visualstudio.com/items?itemName=markis.code-coverage ) .
62+ - Special care should be taken when modifying code that is not covered by unit tests!
63+
64+ Branches that do not pass the test harness (e.g. due to failing unit tests
65+ or lowering the code coverage beneath the desired threshold) should not be
66+ pull-requested.
5167
5268### use the demo script
5369
Original file line number Diff line number Diff line change 3232# https://marketplace.visualstudio.com/items?itemName=markis.code-coverage
3333generate_lcov () {
3434 mkdir -p coverage
35+ # generate coverage report in lcov and HTML format
3536 pdm run coverage-lcov --output_file_path=coverage/lcov.info
37+ pdm run coverage html
3638}
39+
3740trap generate_lcov EXIT
41+ pdm run pytest --cov=feeph.i2c --cov-report=term-missing --no-header --quiet tests/
3842
39- pdm run pytest --cov=feeph.i2c --cov-report= tests/
43+ tox
4044
4145echo " ----------------------------------------------------------------------"
4246echo " If you reached this far you passed. Congratulations!"
Original file line number Diff line number Diff line change @@ -28,9 +28,7 @@ requires =
2828env_list =
2929 lint
3030 type
31- coverage_clean
3231 py{310,311,312}
33- coverage_report
3432
3533; pytest & coverage
3634; https://pytest-cov.readthedocs.io/en/latest/tox.html
@@ -70,28 +68,14 @@ commands =
7068
7169[testenv]
7270description = install pytest in a virtual environment and invoke it on the tests folder
73- depends =
74- {py310,py311,312}: coverage_clean
75- coverage_report: py310,py311,312
7671set_env =
7772 VIRTUALENV_DISCOVERY = pyenv
7873deps =
7974 --global-option =" $(python-config --includes)" -r requirements.txt
8075 --global-option =" $(python-config --includes)" -r requirements-dev.txt
81- # generate a coverage report but do not mesurements and do not fail
82- # (we will combine all measurements into a single report later on)
76+ # do not generate a coverage report from tox
77+ # if we would the files would be relative to the tox virtual environments
78+ # and prefixed with '.tox/py*/lib/python*/site-packages/' - which makes
79+ # them interesting to look at but useless for consumption by other tools
8380commands =
84- pytest --cov =feeph.i2c --cov-append --cov-report = --cov-fail-under =0 {posargs: tests/}
85-
86- [testenv:coverage_clean]
87- deps = coverage
88- skip_install = true
89- commands =
90- coverage erase
91-
92- [testenv:coverage_report]
93- deps = coverage
94- skip_install = true
95- commands =
96- coverage report --show-missing
97- coverage html
81+ pytest --no-cov {posargs: tests/}
You can’t perform that action at this time.
0 commit comments