-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Pydantic <1.11, Test compatibility among supported Python and…
… pydantic versions. (#122) * setup an initial test matrix * add all the static checks and some collections "check_static" and "check_all" * shim nox in for the Make targets * 🤦 * Run test matrix in its own job, static checks only in pr_checks.yml * feat: merge the test matrix back into the main PR check file * feat: refactor the noxfile to have more discrete sessions * feat: update the PR static checks to use a matrix --------- Co-authored-by: Thomas <[email protected]> Co-authored-by: Thomas <[email protected]>
- Loading branch information
1 parent
c4693eb
commit 526c3fd
Showing
6 changed files
with
131 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ mkdocs/ | |
# Ignore dev files | ||
.github/ | ||
.devcontainer/ | ||
.nox/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import nox | ||
|
||
nox.options.sessions = [] | ||
|
||
TESTED_PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11"] | ||
TESTED_PYDANTIC_VERSIONS = ["1.8.2", "1.9.2", "1.10.9"] | ||
|
||
|
||
def install_requirements(session: nox.Session) -> None: | ||
session.install("-r", "requirements.txt") | ||
session.install("-r", "dev-requirements.txt") | ||
|
||
|
||
@nox.session(python=TESTED_PYTHON_VERSIONS) | ||
@nox.parametrize("pydantic_version", TESTED_PYDANTIC_VERSIONS) | ||
def tests(session: nox.Session, pydantic_version: str) -> None: | ||
install_requirements(session) | ||
session.install(".") | ||
session.install(f"pydantic=={pydantic_version}") | ||
if session.posargs: | ||
test_args = session.posargs | ||
else: | ||
test_args = [""] | ||
session.run("pytest", *test_args) | ||
|
||
|
||
@nox.session() | ||
def pytest(session: nox.Session) -> None: | ||
"""Runs the pytest suite with default versions.""" | ||
install_requirements(session) | ||
session.install(".") | ||
session.run("pytest") | ||
|
||
|
||
@nox.session() | ||
def black(session: nox.Session) -> None: | ||
install_requirements(session) | ||
session.run("black", "--check", "src/") | ||
|
||
|
||
@nox.session() | ||
def mypy(session: nox.Session) -> None: | ||
install_requirements(session) | ||
session.run("mypy") | ||
|
||
|
||
@nox.session() | ||
def pylint(session: nox.Session) -> None: | ||
install_requirements(session) | ||
session.run("pylint", "--jobs", "0", "src/") | ||
|
||
|
||
@nox.session() | ||
def xenon(session: nox.Session) -> None: | ||
install_requirements(session) | ||
session.run( | ||
"xenon", | ||
"src", | ||
"--max-absolute", | ||
"B", | ||
"--max-modules", | ||
"B", | ||
"--max-average", | ||
"A", | ||
"--ignore", | ||
"data,tests,docs", | ||
"--exclude", | ||
"src/fideslang/_version.py", | ||
) | ||
|
||
|
||
@nox.session() | ||
def static_checks(session: nox.Session) -> None: | ||
"""Run the static checks.""" | ||
session.notify("black") | ||
session.notify("xenon") | ||
session.notify("pylint") | ||
session.notify("mypy") | ||
|
||
|
||
@nox.session() | ||
def check_all(session: nox.Session) -> None: | ||
"""Run static checks as well as tests.""" | ||
session.notify("static_checks") | ||
session.notify("tests") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pydantic>=1.8.1,<1.10.0 | ||
pydantic>=1.8.1,<1.11.0 | ||
pyyaml>=5,<6 |