Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Python 3.10.0-rc.2 coverage fix #479

Merged
merged 8 commits into from
Sep 16, 2021
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,27 @@ jobs:
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-${{ matrix.python-version }}" "cover" -- --full-trace
FollowTheProcess marked this conversation as resolved.
Show resolved Hide resolved

build-py310:
name: Build python 3.10
runs-on: ${{ matrix.os }}
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" "cover" -- --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