Skip to content

Commit

Permalink
Parametrize Python in Nox session (#383)
Browse files Browse the repository at this point in the history
* ci: Parameterize Python in Nox session `tests`

* ci: Require nox >= 2021.6.6 in Noxfile
  • Loading branch information
cjolowicz authored Jun 11, 2021
1 parent 8e0262b commit 595c744
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

package = "nox_poetry"
python_versions = ["3.9", "3.8", "3.7", "3.6"]
nox.needs_version = ">= 2021.6.6"
nox.options.sessions = (
"pre-commit",
"safety",
Expand Down Expand Up @@ -115,8 +116,11 @@ def mypy(session: Session) -> None:
session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py")


@session(python=python_versions)
@nox.parametrize("poetry", ["1.0.10", None])
@session
@nox.parametrize(
"python,poetry",
[(python_versions[0], "1.0.10"), *((python, None) for python in python_versions)],
)
def tests(session: Session, poetry: Optional[str]) -> None:
"""Run the test suite."""
session.install(".")
Expand All @@ -132,9 +136,6 @@ def tests(session: Session, poetry: Optional[str]) -> None:
session.install("dataclasses")

if poetry is not None:
if session.python != python_versions[0]:
session.skip()

session.run_always(
"python", "-m", "pip", "install", f"poetry=={poetry}", silent=True
)
Expand Down

0 comments on commit 595c744

Please sign in to comment.