From db5d7c9db1c12a93ba4e896c3cb15b77a65607de Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 20 Sep 2021 16:53:20 +0300 Subject: [PATCH 1/7] Replace Travis CI with GitHub Actions --- .github/workflows/examples.yml | 45 +++++++++++++++++ .github/workflows/lint.yml | 41 ++++++++++++++++ .github/workflows/test.yml | 68 ++++++++++++++++++++++++++ .travis.yml | 89 ---------------------------------- CONTRIBUTING.rst | 4 +- MANIFEST.in | 3 +- README.rst | 8 +-- ci/templates/.travis.yml | 61 ----------------------- docs/releasing.rst | 2 +- docs/reporting.rst | 2 +- 10 files changed, 164 insertions(+), 159 deletions(-) create mode 100644 .github/workflows/examples.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml delete mode 100644 ci/templates/.travis.yml diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 00000000..5835c173 --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,45 @@ +name: Examples + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +jobs: + examples: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [ + "src-layout", + "adhoc-layout", + ] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: + examples-v1-${{ hashFiles('**/tox.ini') }} + restore-keys: | + examples-v1- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U wheel + python -m pip install --progress-bar=off tox -rci/requirements.txt + + - name: Examples + run: | + cd examples/${{ matrix.target }} + tox -v diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..001ccfee --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,41 @@ +name: Lint + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + toxenv: ["check", "docs"] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: + lint-v1-${{ hashFiles('**/tox.ini') }} + restore-keys: | + lint-v1- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U wheel + python -m pip install --progress-bar=off tox -rci/requirements.txt + + - name: Lint ${{ matrix.toxenv }} + run: | + tox -v -e ${{ matrix.toxenv }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..b11e9f02 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,68 @@ +name: Test + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["pypy3", "3.6", "3.7", "3.8", "3.9"] + tox-extra-versions: [ + "pytest46-xdist133-coverage55", + "pytest54-xdist133-coverage55", + "pytest62-xdist202-coverage55", + ] + include: + # Add new helper variables to existing jobs + - {python-version: "pypy3", tox-python-version: "pypy3"} + - {python-version: "3.6", tox-python-version: "py36"} + - {python-version: "3.7", tox-python-version: "py37"} + - {python-version: "3.8", tox-python-version: "py38"} + - {python-version: "3.9", tox-python-version: "py39"} + # Add extra jobs to the matrix + - {tox-extra-versions: "pytest46-xdist127", python-version: "pypy-2.7", tox-python-version: "pypy"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "pypy3", tox-python-version: "pypy3"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "2.7", tox-python-version: "py27"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.5", tox-python-version: "py35"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.6", tox-python-version: "py36"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.7", tox-python-version: "py37"} + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: + test-${{ matrix.python-version }}-v1-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + test-${{ matrix.python-version }}-v1- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U wheel + python -m pip install --progress-bar=off tox -rci/requirements.txt + virtualenv --version + pip --version + tox --version + + - name: Tox tests + run: | + tox -v -e ${{ matrix.tox-python-version }}-${{ matrix.tox-extra-versions }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a9cafa4e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,89 +0,0 @@ -# NOTE: this file is auto-generated via ci/bootstrap.py (ci/templates/.travis.yml). -dist: xenial -language: python -cache: false -env: - global: - - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so - - SEGFAULT_SIGNALS=all -stages: - - lint - - examples - - tests -jobs: - fast_finish: true - allow_failures: - - python: '3.8' - include: - - stage: lint - env: TOXENV=check - - env: TOXENV=docs - - - stage: tests - env: TOXENV=py27-pytest46-xdist127-coverage55 - python: '2.7' - - env: TOXENV=py35-pytest46-xdist127-coverage55 - python: '3.5' - - env: TOXENV=py36-pytest46-xdist127-coverage55 - python: '3.6' - - env: TOXENV=py37-pytest46-xdist127-coverage55 - python: '3.7' - - env: TOXENV=pypy-pytest46-xdist127-coverage55 - python: 'pypy' - - env: TOXENV=pypy3-pytest46-xdist127-coverage55 - python: 'pypy3' - - env: TOXENV=py36-pytest46-xdist133-coverage55 - python: '3.6' - - env: TOXENV=py36-pytest54-xdist133-coverage55 - python: '3.6' - - env: TOXENV=py37-pytest46-xdist133-coverage55 - python: '3.7' - - env: TOXENV=py37-pytest54-xdist133-coverage55 - python: '3.7' - - env: TOXENV=py38-pytest46-xdist133-coverage55 - python: '3.8' - - env: TOXENV=py38-pytest54-xdist133-coverage55 - python: '3.8' - - env: TOXENV=pypy3-pytest46-xdist133-coverage55 - python: 'pypy3' - - env: TOXENV=pypy3-pytest54-xdist133-coverage55 - python: 'pypy3' - - env: TOXENV=py36-pytest62-xdist202-coverage55 - python: '3.6' - - env: TOXENV=py37-pytest62-xdist202-coverage55 - python: '3.7' - - env: TOXENV=py38-pytest62-xdist202-coverage55 - python: '3.8' - - env: TOXENV=py39-pytest62-xdist202-coverage55 - python: '3.9' - - env: TOXENV=pypy3-pytest62-xdist202-coverage55 - python: 'pypy3' - - - stage: examples - python: '3.8' - script: cd $TARGET; tox -v - env: - - TARGET=examples/src-layout - - python: '3.8' - script: cd $TARGET; tox -v - env: - - TARGET=examples/adhoc-layout -before_install: - - python --version - - uname -a - - lsb_release -a -install: - - python -mpip install --progress-bar=off tox -rci/requirements.txt - - virtualenv --version - - easy_install --version - - pip --version - - tox --version -script: - - tox -v -after_failure: - - more .tox/log/* | cat - - more .tox/*/log/* | cat -notifications: - email: - on_success: never - on_failure: always diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index f02562eb..e742be47 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -73,8 +73,8 @@ For merging, you should: 3. Add a note to ``CHANGELOG.rst`` about the changes. 4. Add yourself to ``AUTHORS.rst``. -.. [1] If you don't have all the necessary python versions available locally you can rely on Travis - it will - `run the tests `_ +.. [1] If you don't have all the necessary Python versions available locally you can rely on GitHub Actions - it will + `run the tests `_ for each change you add in the pull request. It will be slower though ... diff --git a/MANIFEST.in b/MANIFEST.in index 6db46114..af1581be 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,6 +6,7 @@ prune examples/*/*/htmlcov prune examples/adhoc-layout/*.egg-info prune examples/src-layout/src/*.egg-info +graft .github/workflows graft src graft ci graft tests @@ -21,6 +22,6 @@ include CONTRIBUTING.rst include LICENSE include README.rst -include tox.ini .travis.yml .appveyor.yml .readthedocs.yml .pre-commit-config.yaml +include tox.ini .appveyor.yml .readthedocs.yml .pre-commit-config.yaml global-exclude *.py[cod] __pycache__/* *.so *.dylib .coverage .coverage.* diff --git a/README.rst b/README.rst index 149594fd..fa49179e 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ Overview * - docs - |docs| * - tests - - | |travis| |appveyor| |requires| + - | |github-actions| |appveyor| |requires| * - package - | |version| |conda-forge| |wheel| |supported-versions| |supported-implementations| | |commits-since| @@ -19,9 +19,9 @@ Overview :target: https://readthedocs.org/projects/pytest-cov :alt: Documentation Status -.. |travis| image:: https://api.travis-ci.com/pytest-dev/pytest-cov.svg?branch=master - :alt: Travis-CI Build Status - :target: https://travis-ci.com/github/pytest-dev/pytest-cov +.. |github-actions| image:: https://github.com/pytest-dev/pytest-cov/actions/workflows/test.yml/badge.svg + :alt: GitHub Actions Status + :target: https://github.com/pytest-dev/pytest-cov/actions .. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/pytest-dev/pytest-cov?branch=master&svg=true :alt: AppVeyor Build Status diff --git a/ci/templates/.travis.yml b/ci/templates/.travis.yml deleted file mode 100644 index 8c7e3b93..00000000 --- a/ci/templates/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -dist: xenial -language: python -cache: false -env: - global: - - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so - - SEGFAULT_SIGNALS=all -stages: - - lint - - examples - - tests -jobs: - fast_finish: true - allow_failures: - - python: '3.8' - include: - - stage: lint - env: TOXENV=check - - env: TOXENV=docs - - - stage: tests -{% for env in tox_environments %} - {%+ if not loop.first %}- {% else %} {% endif -%} - env: TOXENV={{ env }} - {% if env.startswith("pypy-") %} - python: 'pypy' - {% elif env.startswith("pypy3-") %} - python: 'pypy3' - {% else %} - python: '{{ "{0[2]}.{0[3]}".format(env) }}' - {% endif -%} -{% endfor %} - - - stage: examples -{%- for example in ['src', 'adhoc'] %}{{ '' }} - {%+ if not loop.first %}- {% else %} {% endif -%} - python: '3.8' - script: cd $TARGET; tox -v - env: - - TARGET=examples/{{ example }}-layout -{%- endfor %} - -before_install: - - python --version - - uname -a - - lsb_release -a -install: - - python -mpip install --progress-bar=off tox -rci/requirements.txt - - virtualenv --version - - easy_install --version - - pip --version - - tox --version -script: - - tox -v -after_failure: - - more .tox/log/* | cat - - more .tox/*/log/* | cat -notifications: - email: - on_success: never - on_failure: always diff --git a/docs/releasing.rst b/docs/releasing.rst index 245dca54..ae78228d 100644 --- a/docs/releasing.rst +++ b/docs/releasing.rst @@ -16,7 +16,7 @@ The process for releasing should follow these steps: git push git push --tags #. Wait for `AppVeyor `_ - and `Travis `_ to give the green builds. + and `GitHub Actions `_ to give the green builds. #. Check that the docs on `ReadTheDocs `_ are built. #. Make sure you have a clean checkout, run ``git status`` to verify. #. Manually clean temporary files (that are ignored and won't show up in ``git status``):: diff --git a/docs/reporting.rst b/docs/reporting.rst index e9e4b06b..eaa99ad3 100644 --- a/docs/reporting.rst +++ b/docs/reporting.rst @@ -71,4 +71,4 @@ The final report option can also suppress printing to the terminal:: This mode can be especially useful on continuous integration servers, where a coverage file is needed for subsequent processing, but no local report needs to be viewed. For example, -tests run on Travis-CI could produce a .coverage file for use with Coveralls. +tests run on GitHub Actions could produce a .coverage file for use with Coveralls. From 3490ccb725758abfbd1162abd53e8a6c454d1f95 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 20 Sep 2021 17:20:33 +0300 Subject: [PATCH 2/7] Python 2.7 and 3.5 support was already dropped --- .github/workflows/test.yml | 16 +++++----------- examples/adhoc-layout/example/__init__.py | 14 ++------------ examples/adhoc-layout/tox.ini | 6 +++--- examples/src-layout/src/example/__init__.py | 14 ++------------ examples/src-layout/tox.ini | 6 +++--- 5 files changed, 15 insertions(+), 41 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b11e9f02..272ade24 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,9 +13,10 @@ jobs: matrix: python-version: ["pypy3", "3.6", "3.7", "3.8", "3.9"] tox-extra-versions: [ - "pytest46-xdist133-coverage55", - "pytest54-xdist133-coverage55", - "pytest62-xdist202-coverage55", + "pytest46-xdist127", + "pytest46-xdist133", + "pytest54-xdist133", + "pytest62-xdist202", ] include: # Add new helper variables to existing jobs @@ -24,13 +25,6 @@ jobs: - {python-version: "3.7", tox-python-version: "py37"} - {python-version: "3.8", tox-python-version: "py38"} - {python-version: "3.9", tox-python-version: "py39"} - # Add extra jobs to the matrix - - {tox-extra-versions: "pytest46-xdist127", python-version: "pypy-2.7", tox-python-version: "pypy"} - - {tox-extra-versions: "pytest46-xdist127", python-version: "pypy3", tox-python-version: "pypy3"} - - {tox-extra-versions: "pytest46-xdist127", python-version: "2.7", tox-python-version: "py27"} - - {tox-extra-versions: "pytest46-xdist127", python-version: "3.5", tox-python-version: "py35"} - - {tox-extra-versions: "pytest46-xdist127", python-version: "3.6", tox-python-version: "py36"} - - {tox-extra-versions: "pytest46-xdist127", python-version: "3.7", tox-python-version: "py37"} steps: - uses: actions/checkout@v2 @@ -65,4 +59,4 @@ jobs: - name: Tox tests run: | - tox -v -e ${{ matrix.tox-python-version }}-${{ matrix.tox-extra-versions }} + tox -v -e ${{ matrix.tox-python-version }}-${{ matrix.tox-extra-versions }}-coverage55 diff --git a/examples/adhoc-layout/example/__init__.py b/examples/adhoc-layout/example/__init__.py index 8a6dfd5e..4693ad3c 100644 --- a/examples/adhoc-layout/example/__init__.py +++ b/examples/adhoc-layout/example/__init__.py @@ -1,12 +1,2 @@ -import sys - -PY2 = sys.version_info[0] == 2 - - -if PY2: - def add(a, b): - return b + a - -else: - def add(a, b): - return a + b +def add(a, b): + return a + b diff --git a/examples/adhoc-layout/tox.ini b/examples/adhoc-layout/tox.ini index 6e299f24..7b6f7c43 100644 --- a/examples/adhoc-layout/tox.ini +++ b/examples/adhoc-layout/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py38,report +envlist = py38,report [tool:pytest] addopts = @@ -7,7 +7,7 @@ addopts = [testenv] setenv = - py{27,38}: COVERAGE_FILE = .coverage.{envname} + py38: COVERAGE_FILE = .coverage.{envname} commands = pytest --cov --cov-config={toxinidir}/.coveragerc {posargs:-vv} deps = pytest @@ -19,7 +19,7 @@ deps = ../.. depends = - report: py27,py38 + report: py38 # note that this is necessary to prevent the tests importing the code from your badly laid project changedir = tests diff --git a/examples/src-layout/src/example/__init__.py b/examples/src-layout/src/example/__init__.py index 8a6dfd5e..4693ad3c 100644 --- a/examples/src-layout/src/example/__init__.py +++ b/examples/src-layout/src/example/__init__.py @@ -1,12 +1,2 @@ -import sys - -PY2 = sys.version_info[0] == 2 - - -if PY2: - def add(a, b): - return b + a - -else: - def add(a, b): - return a + b +def add(a, b): + return a + b diff --git a/examples/src-layout/tox.ini b/examples/src-layout/tox.ini index 6be8e73d..5a2083c9 100644 --- a/examples/src-layout/tox.ini +++ b/examples/src-layout/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py38,report +envlist = py38,report [tool:pytest] testpaths = tests @@ -8,7 +8,7 @@ addopts = [testenv] setenv = - py{27,38}: COVERAGE_FILE = .coverage.{envname} + py38: COVERAGE_FILE = .coverage.{envname} commands = pytest --cov {posargs:-vv} deps = pytest @@ -20,7 +20,7 @@ deps = ../.. depends = - report: py27,py38 + report: py38 [testenv:report] skip_install = true From f81aa0c90c8f423248d8596179dfcbd8627a9a0f Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 20 Sep 2021 17:46:45 +0300 Subject: [PATCH 3/7] Remove some jobs from the matrix --- .github/workflows/test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 272ade24..e09414f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,6 +25,12 @@ jobs: - {python-version: "3.7", tox-python-version: "py37"} - {python-version: "3.8", tox-python-version: "py38"} - {python-version: "3.9", tox-python-version: "py39"} + exclude: + # Remove some jobs from the matrix + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.8"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.9"} + - {tox-extra-versions: "pytest46-xdist133", python-version: "3.9"} + - {tox-extra-versions: "pytest54-xdist133", python-version: "3.9"} steps: - uses: actions/checkout@v2 From a948e899fa002fbc7f52c6c0f7e7dffdf7987ec8 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 21 Sep 2021 10:30:18 +0300 Subject: [PATCH 4/7] Test both PyPy3.6 and PyPy3.7 Co-authored-by: Thomas Grainger --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e09414f4..51a03bef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["pypy3", "3.6", "3.7", "3.8", "3.9"] + python-version: ["pypy-3.6", "pypy-3.7", "3.6", "3.7", "3.8", "3.9"] tox-extra-versions: [ "pytest46-xdist127", "pytest46-xdist133", From f4a88d6187630295ce960010456def6b19ef01b2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 21 Sep 2021 10:34:07 +0300 Subject: [PATCH 5/7] Test both PyPy3.6 and PyPy3.7 --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51a03bef..967386af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,8 @@ jobs: ] include: # Add new helper variables to existing jobs - - {python-version: "pypy3", tox-python-version: "pypy3"} + - {python-version: "pypy-3.6", tox-python-version: "pypy3"} + - {python-version: "pypy-3.7", tox-python-version: "pypy3"} - {python-version: "3.6", tox-python-version: "py36"} - {python-version: "3.7", tox-python-version: "py37"} - {python-version: "3.8", tox-python-version: "py38"} From 6395ecec756433194c05d34af490315b35dddafa Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 21 Sep 2021 10:40:56 +0300 Subject: [PATCH 6/7] Test conditional collection on PyPy and CPython --- .github/workflows/examples.yml | 12 ++++++++---- examples/adhoc-layout/example/__init__.py | 13 +++++++++++-- examples/adhoc-layout/tox.ini | 6 +++--- examples/src-layout/src/example/__init__.py | 13 +++++++++++-- examples/src-layout/tox.ini | 6 +++--- 5 files changed, 36 insertions(+), 14 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 5835c173..dbd62a6c 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -11,18 +11,22 @@ jobs: strategy: fail-fast: false matrix: + python-version: ["pypy-3.7", "3.9"] target: [ "src-layout", "adhoc-layout", ] - + include: + # Add new helper variables to existing jobs + - {python-version: "pypy-3.7", tox-python-version: "pypy3"} + - {python-version: "3.9", tox-python-version: "py39"} steps: - uses: actions/checkout@v2 - - name: Set up Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: ${{ matrix.python-version }} - name: Cache uses: actions/cache@v2 @@ -42,4 +46,4 @@ jobs: - name: Examples run: | cd examples/${{ matrix.target }} - tox -v + tox -v -e ${{ matrix.tox-python-version }} diff --git a/examples/adhoc-layout/example/__init__.py b/examples/adhoc-layout/example/__init__.py index 4693ad3c..684905a1 100644 --- a/examples/adhoc-layout/example/__init__.py +++ b/examples/adhoc-layout/example/__init__.py @@ -1,2 +1,11 @@ -def add(a, b): - return a + b +import platform + +# test merging multiple tox runs with a platform +# based branch +if platform.python_implementation() == "PyPy": + def add(a, b): + return a + b + +else: + def add(a, b): + return a + b diff --git a/examples/adhoc-layout/tox.ini b/examples/adhoc-layout/tox.ini index 7b6f7c43..e855c315 100644 --- a/examples/adhoc-layout/tox.ini +++ b/examples/adhoc-layout/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38,report +envlist = pypy3,py39,report [tool:pytest] addopts = @@ -7,7 +7,7 @@ addopts = [testenv] setenv = - py38: COVERAGE_FILE = .coverage.{envname} + py{py3,39}: COVERAGE_FILE = .coverage.{envname} commands = pytest --cov --cov-config={toxinidir}/.coveragerc {posargs:-vv} deps = pytest @@ -19,7 +19,7 @@ deps = ../.. depends = - report: py38 + report: pypy3,py39 # note that this is necessary to prevent the tests importing the code from your badly laid project changedir = tests diff --git a/examples/src-layout/src/example/__init__.py b/examples/src-layout/src/example/__init__.py index 4693ad3c..684905a1 100644 --- a/examples/src-layout/src/example/__init__.py +++ b/examples/src-layout/src/example/__init__.py @@ -1,2 +1,11 @@ -def add(a, b): - return a + b +import platform + +# test merging multiple tox runs with a platform +# based branch +if platform.python_implementation() == "PyPy": + def add(a, b): + return a + b + +else: + def add(a, b): + return a + b diff --git a/examples/src-layout/tox.ini b/examples/src-layout/tox.ini index 5a2083c9..94b72730 100644 --- a/examples/src-layout/tox.ini +++ b/examples/src-layout/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38,report +envlist = pypy3,py39,report [tool:pytest] testpaths = tests @@ -8,7 +8,7 @@ addopts = [testenv] setenv = - py38: COVERAGE_FILE = .coverage.{envname} + py{py3,39}: COVERAGE_FILE = .coverage.{envname} commands = pytest --cov {posargs:-vv} deps = pytest @@ -20,7 +20,7 @@ deps = ../.. depends = - report: py38 + report: pypy3,py39 [testenv:report] skip_install = true From 96f9aad28a35d9d0824add0ef2309e600052c531 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 21 Sep 2021 10:53:55 +0300 Subject: [PATCH 7/7] Add 'all good' job to be added as a required build --- .github/workflows/test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 967386af..a60cbd96 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,3 +67,11 @@ jobs: - name: Tox tests run: | tox -v -e ${{ matrix.tox-python-version }}-${{ matrix.tox-extra-versions }}-coverage55 + + allgood: + needs: test + runs-on: ubuntu-latest + name: Test successful + steps: + - name: Success + run: echo Test successful