Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzymadness committed Feb 20, 2023
1 parent b6b590b commit ec6c215
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 48 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CI
on:
push:
branches: [main]
branches: [tox4]
pull_request:

env:
Expand All @@ -18,6 +18,7 @@ jobs:
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
tox-version: ["latest", "<4"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -35,7 +36,33 @@ jobs:
run: |
python -m pip install --disable-pip-version-check .
- name: Run tests on ${{ matrix.os }}
run: nox --non-interactive --error-on-missing-interpreter --session "tests-${{ matrix.python-version }}" -- --full-trace
run: nox --non-interactive --error-on-missing-interpreter --session "tests(python='${{ matrix.python-version }}', tox_version='${{ matrix.tox-version }}')" -- --full-trace
- name: Save coverage report
uses: actions/upload-artifact@v3
with:
name: coverage
path: .coverage.*

coverage:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Nox-under-test
run: |
python -m pip install --disable-pip-version-check .
- name: Download individual coverage reports
uses: actions/download-artifact@v3
with:
name: coverage
- name: Display structure of downloaded files
run: ls -aR
- name: Run coverage
run: nox --non-interactive --session "cover"

lint:
runs-on: ubuntu-latest
Expand Down
14 changes: 11 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@
(python, tox_version)
for python in ("3.7", "3.8", "3.9", "3.10", "3.11")
for tox_version in ("latest", "<4")
if (python, tox_version) != ("3.7", "latest")
],
)
def tests(session: nox.Session, tox_version: str) -> None:
"""Run test suite with pytest."""
# Because there is a dependency conflict between
# argcomplete and the latest tox (both depend on
# a different version of importlibmetadata for Py 3.7)
# pip installs tox 3 as the latest one for Py 3.7.
if session.python == "3.7" and tox_version == "latest":
return

session.create_tmp() # Fixes permission errors on Windows
session.install("-r", "requirements-test.txt")
session.install("-e", ".[tox_to_nox]")
Expand All @@ -55,7 +61,9 @@ def tests(session: nox.Session, tox_version: str) -> None:
"pyproject.toml",
"--cov-report=",
*session.posargs,
env={"COVERAGE_FILE": f".coverage.{session.python}.{tox_version}"},
env={
"COVERAGE_FILE": f".coverage.{session.python}.tox.{tox_version.lstrip('<')}"
},
)


Expand All @@ -78,7 +86,7 @@ def cover(session: nox.Session) -> None:

session.install("coverage[toml]")
session.run("coverage", "combine")
session.run("coverage", "report", "--fail-under=100", "--show-missing")
session.run("coverage", "report")
session.run("coverage", "erase")


Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ profile = "black"

[tool.coverage.run]
branch = true
relative_files = true
omit = [ "nox/_typing.py" ]

[tool.coverage.report]
exclude_lines = [ "pragma: no cover", "if TYPE_CHECKING:", "@overload" ]
show_missing = true
fail_under = 100

[tool.pytest.ini_options]
minversion = "6.0"
Expand Down
Loading

0 comments on commit ec6c215

Please sign in to comment.