File tree Expand file tree Collapse file tree 5 files changed +30
-5
lines changed
Expand file tree Collapse file tree 5 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,23 @@ Run the tests:
9898pytest
9999```
100100
101- Install the package with ` pipx ` :
101+ Run the tests with [ coverage] ( https://coverage.readthedocs.io/ ) :
102+
103+ ``` sh
104+ coverage run -m pytest
105+ ```
106+
107+ Generate a coverage report:
108+
109+ ``` sh
110+ coverage report
111+ ```
112+
113+ ``` sh
114+ coverage html
115+ ```
116+
117+ Install the package with [ pipx] ( https://pipx.pypa.io/ ) :
102118
103119``` sh
104120pipx install .
Original file line number Diff line number Diff line change 2020 - name : Install dependencies
2121 run : pip install -e .[test]
2222
23- - name : Run pytest
24- run : pytest
23+ - name : Run tests and collect coverage
24+ run : |
25+ coverage run -m pytest
26+ coverage report
27+ coverage xml
28+
29+ - name : Upload coverage to Codecov
30+ uses : codecov/codecov-action@v5
31+ with :
32+ token : ${{ secrets.CODECOV_TOKEN }}
Original file line number Diff line number Diff line change 11# python_cli_template
22
33[ ![ PyPI version] ( https://badgen.net/pypi/v/python_cli_template )] ( https://pypi.org/project/python_cli_template/ )
4- [ ![ test ] ( https://github.com/ remarkablemark/python_cli_template/actions/workflows/test.yml/ badge.svg )] ( https://github.com/ remarkablemark/python_cli_template/actions/workflows/test.yml )
4+ [ ![ codecov ] ( https://codecov.io/gh/ remarkablemark/python_cli_template/graph/ badge.svg?token=l6pg0nf9aJ )] ( https://codecov.io/gh/ remarkablemark/python_cli_template )
55[ ![ lint] ( https://github.com/remarkablemark/python_cli_template/actions/workflows/lint.yml/badge.svg )] ( https://github.com/remarkablemark/python_cli_template/actions/workflows/lint.yml )
66
77🐍 Python CLI Template
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ build = [
2828]
2929test = [
3030 " black==25.1.0" ,
31+ " coverage==7.7.1" ,
3132 " isort==6.0.1" ,
3233 " pre-commit==4.2.0" ,
3334 " pytest==8.3.5" ,
Original file line number Diff line number Diff line change @@ -34,5 +34,5 @@ def main(argv: list[str] = None) -> None:
3434 print (f"{ color } { hello (args .name )} " )
3535
3636
37- if __name__ == "__main__" :
37+ if __name__ == "__main__" : # pragma: no cover
3838 main ()
You can’t perform that action at this time.
0 commit comments