File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 - ' tests/**'
1010 pull_request :
1111
12+ env :
13+ COV_PYTHON_VERSION : " 3.9"
14+
1215jobs :
1316 python-unit :
1417 runs-on : ubuntu-latest
3235 pip install -e ".[dev]"
3336 python -m pip install tox tox-gh-actions
3437 if : steps.python-cache.outputs.cache-hit != 'true'
35- - name : Run unit tests
38+
39+ # for all versions but the one we use for code coverage, run normally
40+ - name : Run unit tests normally
3641 run : tox
42+ if : ${{ matrix.python != env.COV_PYTHON_VERSION }}
43+
44+ # run code coverage in one version only
45+ - name : Run unit tests with code coverage reporting
46+ run : tox -e coverage
47+ if : ${{ matrix.python == env.COV_PYTHON_VERSION }}
48+ - name : Upload test coverage to Codecov
49+ uses : codecov/codecov-action@v3
50+ if : ${{ matrix.python == env.COV_PYTHON_VERSION }}
51+
Original file line number Diff line number Diff line change 3434ENV /
3535env.bak /
3636venv.bak /
37+
38+ # code coverage
39+ .coverage
40+ coverage.xml
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ Repository for the DHTech 2022 Hackathon
44
55[ ![ License] ( https://img.shields.io/badge/License-Apache_2.0-blue.svg )] ( https://opensource.org/licenses/Apache-2.0 )
66[ ![ unit tests] ( https://github.com/dh-tech/hackathon-2022/actions/workflows/unit_tests.yml/badge.svg )] ( https://github.com/dh-tech/hackathon-2022/actions/workflows/unit_tests.yml )
7+ [ ![ codecov] ( https://codecov.io/gh/dh-tech/hackathon-2022/branch/main/graph/badge.svg?token=GE7HZE8C9D )] ( https://codecov.io/gh/dh-tech/hackathon-2022 )
78[ ![ Code style: black] ( https://img.shields.io/badge/code%20style-black-000000.svg )] ( https://github.com/psf/black )
89<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
910[ ![ All Contributors] ( https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square )] ( #contributors- )
Original file line number Diff line number Diff line change 3939 tox
4040 sphinx
4141 twine
42- test =
42+ wheel
43+ pytest-cov
44+ test =
4345 pytest>=7.2
4446
4547[options.packages.find]
Original file line number Diff line number Diff line change 1+ import pytest
2+
13from undate .dateformat .base import BaseDateFormat
24
35
@@ -26,3 +28,11 @@ def test_formatters_are_unique(self):
2628 # name = "ISO8601"
2729
2830 # assert len(BaseDateFormat.available_formatters()) != len(BaseDateFormat.__subclasses__())
31+
32+ def test_parse_not_implemented (self ):
33+ with pytest .raises (NotImplementedError ):
34+ BaseDateFormat ().parse ("foo bar baz" )
35+
36+ def test_parse_to_string (self ):
37+ with pytest .raises (NotImplementedError ):
38+ BaseDateFormat ().to_string (1991 )
Original file line number Diff line number Diff line change @@ -27,6 +27,13 @@ deps =
2727commands =
2828 flake8 --ignore =E501,E402,F401 src/undate/ tests/
2929
30+ [testenv:coverage]
31+ deps =
32+ pytest
33+ pytest-cov
34+ commands =
35+ pytest --cov =./ --cov-report =xml
36+
3037[testenv:docs]
3138description = invoke sphinx-build to build the HTML docs
3239basepython = python3.10
You can’t perform that action at this time.
0 commit comments