File tree Expand file tree Collapse file tree 6 files changed +165
-4
lines changed Expand file tree Collapse file tree 6 files changed +165
-4
lines changed Original file line number Diff line number Diff line change 3939 - name : Run unittests
4040 run : |
4141 mkdir -p reports
42- PYTHONPATH=./src:./tests poetry run pytest ./tests/unit_test --junitxml=reports/report.xml
42+ PYTHONPATH=./src:./tests poetry run pytest \
43+ --cov=src \
44+ --cov-report=xml:reports/coverage.xml \
45+ --junitxml=reports/report.xml \
46+ ./tests/unit_test
47+
48+ - name : Upload coverage report
49+ if : matrix.python-version == '3.12'
50+ uses : actions/upload-artifact@v4
51+ with :
52+ name : coverage-${{ matrix.python-version }}
53+ path : reports/coverage.xml
54+
55+ - name : Upload to Codecov
56+ if : matrix.python-version == '3.12'
57+ uses : codecov/codecov-action@v4
58+ with :
59+ files : reports/coverage.xml
60+ flags : unittests
61+ fail_ci_if_error : true
4362
4463 - name : Upload JUnit report
4564 uses : actions/upload-artifact@v4
Original file line number Diff line number Diff line change @@ -75,3 +75,9 @@ env.make
7575
7676# Docs
7777docs /.venv
78+
79+ # Test Coverage
80+ .coverage
81+
82+ # Test Reports
83+ reports /
Original file line number Diff line number Diff line change 3232
3333.PHONY : test
3434test : # # run test suite
35- PYTHONPATH=$(SRC ) :$(TESTS ) poetry run pytest $(TESTS )
35+ PYTHONPATH=$(SRC ) :$(TESTS ) poetry run pytest \
36+ $(TESTS )
37+
38+ .PHONY : test-coverage
39+ test-coverage : # # run test suite with coverage and show terminal report
40+ PYTHONPATH=$(SRC ) :$(TESTS ) poetry run pytest \
41+ --cov=$(SRC ) \
42+ --cov-report=term-missing \
43+ --cov-report=xml:reports/coverage.xml \
44+ --cov-fail-under=90 \
45+ $(TESTS )
3646
3747# ###############################################################################
3848# RELEASE
Original file line number Diff line number Diff line change 22[ ![ Author: David Runemalm] ( https://img.shields.io/badge/Author-David%20Runemalm-blue )] ( https://www.davidrunemalm.com )
33[ ![ Python Versions] ( https://img.shields.io/pypi/pyversions/py-dependency-injection )] ( https://pypi.org/project/py-dependency-injection/ )
44[ ![ Master workflow] ( https://github.com/runemalm/py-dependency-injection/actions/workflows/master.yml/badge.svg?branch=master )] ( https://github.com/runemalm/py-dependency-injection/actions/workflows/master.yml )
5+ [ ![ Codecov] ( https://codecov.io/gh/runemalm/py-dependency-injection/branch/master/graph/badge.svg )] ( https://codecov.io/gh/runemalm/py-dependency-injection )
56[ ![ PyPI version] ( https://badge.fury.io/py/py-dependency-injection.svg )] ( https://pypi.org/project/py-dependency-injection/ )
67![ Downloads] ( https://pepy.tech/badge/py-dependency-injection )
78![ No dependencies] ( https://img.shields.io/badge/dependencies-none-brightgreen )
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ pre-commit = "*"
4242pytest = " *"
4343setuptools = " *"
4444wheel = " *"
45+ pytest-cov = " ^6.2.1"
4546
4647[build-system ]
4748requires = [" poetry-core>=2.0.0,<3.0.0" ]
You can’t perform that action at this time.
0 commit comments