diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..8977d2e --- /dev/null +++ b/.coveragerc @@ -0,0 +1,17 @@ +[run] +branch = True +source = packet + +[report] +exclude_lines = + pragma: no cover + def __repr__ + if .debug: + raise NotImplementedError + if __name__ == .__main__.: +ignore_errors = True +omit = + .tox/* + test/* + setup.py + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d9250db..2bb99b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: python-version: - - 3.8 + - '3.10' steps: - uses: actions/checkout@v2 @@ -30,10 +30,9 @@ jobs: matrix: python-version: - 2.7 - - 3.6 - - 3.7 - 3.8 - 3.9 + - '3.10' steps: - uses: actions/checkout@v2 @@ -41,8 +40,25 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - id: test + - name: Install Dependencies run: | python -m pip install --upgrade setuptools pip wheel pip install tox tox-gh-actions + - name: Test with tox + run: | tox + find . # TODO: remove this + # - name: Upload coverage.xml + # if: ${{ matrix.python-version == '3.10' }} + # uses: actions/upload-artifact@v2 + # with: + # name: tox-gh-actions-coverage + # path: coverage.xml + # if-no-files-found: error + - uses: codecov/codecov-action@v2 + if: ${{ matrix.python-version == '3.10' }} + with: + flags: unittests # optional + name: codecov-umbrella # optional + fail_ci_if_error: true # optional (default = false) + verbose: true # optional (default = false) diff --git a/.gitignore b/.gitignore index 2d55625..06651ca 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ htmlcov/ .cache nosetests.xml coverage.xml +unittest_*.xml *,cover .hypothesis/ diff --git a/test/.coveragerc b/test/.coveragerc deleted file mode 100644 index 8fcbd7e..0000000 --- a/test/.coveragerc +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: LGPL-3.0-only - -[report] -omit = - */.local/* - -include= - *packet* diff --git a/tox.ini b/tox.ini index c667ef2..e9f3c7e 100644 --- a/tox.ini +++ b/tox.ini @@ -2,25 +2,46 @@ [tox] -envlist = py27,py36,py37,py38,py39 +envlist = py27,py38,py39,py310 skip_missing_interpreters=True +[tool:pytest] +testpaths = test +# addopts = + [gh-actions] python = 2.7: py27 - 3.6: py36 - 3.7: py37 - 3.8: py38, mypy + 3.8: py38 3.9: py39 + 3.10: py310, mypy [testenv] +usedevelop=True setenv = PACKET_AUTH_TOKEN = {env:PACKET_AUTH_TOKEN:} deps = pytest + coverage pytest-cov requests_mock commands= - py.test -v --cov {envsitepackagesdir}/packet --cov-report=term-missing test + py.test --cov-append --cov-report=term-missing --cov packet --cov-report xml:{envdir}/../../coverage.xml --junitxml=unittest_{envname}.xml {posargs:-vv} + +depends = + {py39}: clean + report: py39 + +[testenv:report] +deps = coverage +skip_install = true +commands = + coverage report + coverage xml:coverage.xml + +[testenv:clean] +deps = coverage +skip_install = true +commands = coverage erase