-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
66 additions
and
25 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
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,54 @@ | ||
"""Define nox actions.""" | ||
import tempfile | ||
from typing import Any | ||
|
||
import nox | ||
|
||
|
||
def install_with_constraints(session: nox.sessions.Session, *args: str, **kwargs: Any): | ||
"""Install PyPI packages based on pyproject.toml constraints.""" | ||
with tempfile.NamedTemporaryFile() as requirements: | ||
session.run( | ||
"poetry", | ||
"export", | ||
"--dev", | ||
"--without-hashes", | ||
"--format=requirements.txt", | ||
f"--output={requirements.name}", | ||
external=True, | ||
) | ||
session.install(f"--constraint={requirements.name}", *args, **kwargs) | ||
|
||
|
||
@nox.session | ||
def coverage(session: nox.sessions.Session) -> None: | ||
"""Run all tests.""" | ||
args = session.posargs or [ | ||
"-s", | ||
"--cov=aioguardian", | ||
"--cov-report=term-missing", | ||
"--cov-report=xml", | ||
"tests/", | ||
] | ||
session.run("poetry", "install", "--no-dev", external=True) | ||
install_with_constraints( | ||
session, "aresponses", "pytest", "pytest-aiohttp", "pytest-cov" | ||
) | ||
session.run("pytest", *args) | ||
|
||
|
||
@nox.session | ||
def docs(session: nox.sessions.Session) -> None: | ||
"""Generate a local copy of the docs.""" | ||
session.run("poetry", "install", "--no-dev", external=True) | ||
install_with_constraints(session, "Sphinx", "sphinx-rtd-theme") | ||
session.run("sphinx-build", "./docs", "./docs/_build") | ||
|
||
|
||
@nox.session | ||
def tests(session: nox.sessions.Session) -> None: | ||
"""Run all tests.""" | ||
args = session.posargs or ["-s", "tests/"] | ||
session.run("poetry", "install", "--no-dev", external=True) | ||
install_with_constraints(session, "aresponses", "pytest", "pytest-aiohttp") | ||
session.run("pytest", *args) |
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 was deleted.
Oops, something went wrong.