From 31b92cdecdd0b612a2685982f246d829efc0614b Mon Sep 17 00:00:00 2001 From: Tim Harder Date: Thu, 4 Mar 2021 13:14:32 -0700 Subject: various tox and github testing updates --- .coveragerc | 8 ++------ .github/workflows/test.yml | 13 ++++--------- pyproject.toml | 5 +++++ requirements/ci.txt | 1 + requirements/tox.txt | 5 ++--- tox.ini | 34 +++++----------------------------- 6 files changed, 19 insertions(+), 47 deletions(-) create mode 100644 requirements/ci.txt diff --git a/.coveragerc b/.coveragerc index 68b60c0a5..7f2b36273 100644 --- a/.coveragerc +++ b/.coveragerc @@ -2,15 +2,11 @@ source = pkgcore branch = True omit = + src/* tests/* - */_const.py - */_verinfo.py [paths] -source = - src/pkgcore - build/install/lib/python*/site-packages/pkgcore - .tox/*/lib/python*/site-packages/pkgcore +source = **/site-packages/pkgcore [report] show_missing = True diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cd9a75727..9a5828dee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,22 +41,17 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip coverage - pip install -r requirements/dev.txt + python -m pip install --upgrade pip pip install -r requirements/test.txt + pip install -r requirements/ci.txt + pip install . - name: Test with pytest # forcibly enable pytest colors env: PY_COLORS: 1 run: | - coverage run -p setup.py test - - - name: Report code coverage - run: | - coverage combine - coverage report - coverage xml + pytest --cov --cov-report=term --cov-report=xml -v - name: Submit code coverage to codecov uses: codecov/codecov-action@v1 diff --git a/pyproject.toml b/pyproject.toml index 249dcf1cb..a904db20f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,3 +4,8 @@ requires = [ "snakeoil @ https://github.com/pkgcore/snakeoil/archive/master.tar.gz#egg=snakeoil", ] build-backend = "setuptools.build_meta" + +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "-ra -q" +testpaths = ["tests"] diff --git a/requirements/ci.txt b/requirements/ci.txt new file mode 100644 index 000000000..c75c448bb --- /dev/null +++ b/requirements/ci.txt @@ -0,0 +1 @@ +pytest-cov diff --git a/requirements/tox.txt b/requirements/tox.txt index d423618dc..4e49649db 100644 --- a/requirements/tox.txt +++ b/requirements/tox.txt @@ -1,4 +1,3 @@ +-r dev.txt -r test.txt - -pytest-xdist -coverage +-r ci.txt diff --git a/tox.ini b/tox.ini index d79f422df..90a5d0dfc 100644 --- a/tox.ini +++ b/tox.ini @@ -1,28 +1,17 @@ [tox] -envlist = py38, py39, coverage-report +envlist = py38, py39 [testenv] # force latest virtualenv/pip download = true -install_command = "{toxinidir}"/requirements/pip.sh {packages} -deps = - -rrequirements/tox.txt -commands = - coverage run -p -m pytest {posargs:-v} - -# generate coverage report -[testenv:coverage-report] -skip_install = true -deps = coverage -ignore_errors = true +deps = -rrequirements/tox.txt commands = - coverage combine - coverage html - coverage report + pytest --cov {posargs:-v} # build docs [testenv:docs] skip_install = true deps = + -rrequirements/dev.txt -rrequirements/docs.txt commands = python setup.py build_man build_docs @@ -31,21 +20,8 @@ commands = [testenv:dist] skip_install = true deps = + -rrequirements/dev.txt -rrequirements/docs.txt - -rrequirements/wheel.txt commands = python setup.py sdist python setup.py bdist_wheel - -# test against latest git -[testenv:dev] -deps = - -rrequirements/dev.txt - -rrequirements/tox.txt -commands = - coverage run -p -m pytest {posargs:-v} - -# stub for travis-ci -[testenv:travis] -commands = - coverage run -p -m pytest {posargs:-v} -- cgit v1.2.3-65-gdbad