mirror of
https://github.com/andrewthetechie/py-healthchecks.io.git
synced 2025-12-06 01:28:26 +01:00
feat: add python 3.11 support (#392)
* feat: add python 3.11 support - adds testing for python 3.11 - moves from black and flake8 to ruff for linting - Updates coverage output from tests * fix: fix dev dependency group * fix: add installing dev dependencies * ci: add toml * ci: simplify coverage * ci: update coverage
This commit is contained in:
45
noxfile.py
45
noxfile.py
@@ -7,6 +7,7 @@ from pathlib import Path
|
||||
from textwrap import dedent
|
||||
|
||||
import nox
|
||||
import toml
|
||||
|
||||
try:
|
||||
from nox_poetry import Session
|
||||
@@ -22,7 +23,7 @@ except ImportError:
|
||||
|
||||
|
||||
package = "healthchecks_io"
|
||||
python_versions = ["3.10", "3.9", "3.8", "3.7"]
|
||||
python_versions = ["3.10", "3.11", "3.9", "3.8", "3.7"]
|
||||
nox.needs_version = ">= 2021.6.6"
|
||||
nox.options.sessions = (
|
||||
"pre-commit",
|
||||
@@ -43,6 +44,9 @@ test_requirements = (
|
||||
"pytest-asyncio",
|
||||
"pytest-lazy-fixture",
|
||||
)
|
||||
mypy_type_packages = ()
|
||||
pyproject = toml.load("pyproject.toml")
|
||||
test_requirements = pyproject["tool"]["poetry"]["group"]["dev"]["dependencies"].keys()
|
||||
|
||||
|
||||
def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
|
||||
@@ -61,8 +65,7 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
|
||||
# quoting rules for Python and bash, but strip the outermost quotes so we
|
||||
# can detect paths within the bindir, like <bindir>/python.
|
||||
bindirs = [
|
||||
bindir[1:-1] if bindir[0] in "'\"" else bindir
|
||||
for bindir in (repr(session.bin), shlex.quote(session.bin))
|
||||
bindir[1:-1] if bindir[0] in "'\"" else bindir for bindir in (repr(session.bin), shlex.quote(session.bin))
|
||||
]
|
||||
|
||||
virtualenv = session.env.get("VIRTUAL_ENV")
|
||||
@@ -99,10 +102,7 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
|
||||
|
||||
text = hook.read_text()
|
||||
|
||||
if not any(
|
||||
Path("A") == Path("a") and bindir.lower() in text.lower() or bindir in text
|
||||
for bindir in bindirs
|
||||
):
|
||||
if not any(Path("A") == Path("a") and bindir.lower() in text.lower() or bindir in text for bindir in bindirs):
|
||||
continue
|
||||
|
||||
lines = text.splitlines()
|
||||
@@ -144,9 +144,7 @@ def safety(session: Session) -> None:
|
||||
session.install("safety")
|
||||
# ignore https://github.com/pytest-dev/py/issues/287
|
||||
# its an irresposnbily filed CVE causing nose
|
||||
session.run(
|
||||
"safety", "check", "--full-report", f"--file={requirements}", "--ignore=51457"
|
||||
)
|
||||
session.run("safety", "check", "--full-report", f"--file={requirements}", "--ignore=51457")
|
||||
|
||||
|
||||
@session(python=python_versions)
|
||||
@@ -171,32 +169,7 @@ def tests(session: Session) -> None:
|
||||
"""Run the test suite."""
|
||||
session.install(".")
|
||||
session.install(*test_requirements)
|
||||
try:
|
||||
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs)
|
||||
finally:
|
||||
if session.interactive:
|
||||
session.notify("coverage", posargs=[])
|
||||
|
||||
|
||||
@session(python=python_versions[0])
|
||||
def coverage(session: Session) -> None:
|
||||
"""Produce the coverage report."""
|
||||
args = session.posargs or ["report"]
|
||||
|
||||
session.install("coverage[toml]")
|
||||
|
||||
if not session.posargs and any(Path().glob(".coverage.*")):
|
||||
session.run("coverage", "combine")
|
||||
|
||||
session.run("coverage", *args)
|
||||
|
||||
|
||||
@session(python=python_versions)
|
||||
def typeguard(session: Session) -> None:
|
||||
"""Runtime type checking using Typeguard."""
|
||||
session.install(".")
|
||||
session.install("pytest", "typeguard", "pygments")
|
||||
session.run("pytest", f"--typeguard-packages={package}", *session.posargs)
|
||||
session.run("poetry", "run", "pytest", *session.posargs)
|
||||
|
||||
|
||||
@session(python=python_versions)
|
||||
|
||||
Reference in New Issue
Block a user