generated from bachya/pypi-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use nox for test automation * Update CI
- Loading branch information
Showing
8 changed files
with
60 additions
and
38 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,48 @@ | ||
"""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=aioridwell", | ||
"--cov-report=term-missing", | ||
"--cov-report=xml", | ||
"tests/", | ||
] | ||
session.run("poetry", "install", "--no-dev", external=True) | ||
install_with_constraints( | ||
session, "aresponses", "freezegun", "pytest", "pytest-aiohttp", "pytest-cov" | ||
) | ||
session.run("pytest", *args) | ||
|
||
|
||
@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", "freezegun", "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.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.