Skip to content

Clean up nox files #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ venv/
Dockerfile
.dockerignore
build/
.tox/
.nox/
.pytest_cache/
.mypy_cache/
.github/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Makefile. If you are on Windows you can install make using scoop or chocolatey.
| `coverage` | Run tests with coverage, generate console report |
| `docker-test` | Run coverage and tests in a docker container. |
| `build-dist` | Build source distribution and wheel distribution |
| `clean` | Deletes build, tox, coverage, pytest, mypy, cache, and pyc artifacts |
| `clean` | Deletes build, nox, coverage, pytest, mypy, cache, and pyc artifacts |


Clone this repo and enter root directory of repo:
Expand Down
22 changes: 14 additions & 8 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
python=["3.8", "3.9", "3.10", "3.11", "3.12"],
)
def tests_with_coverage(session: nox.Session) -> None:
session.log(f"Running from: {session.bin}")
session.log(f"Running with: {session.python}")
"""Run unit tests with coverage saved to partial file."""
print_standard_logs(session)

session.install(".[test]")
session.run("coverage", "run", "-p", "-m", "pytest", "tests/")


@nox.session()
def coverage_combine_and_report(session: nox.Session) -> None:
version = session.run("python", "--version", silent=True)
session.log(f"Running from: {session.bin}")
session.log(f"Running with: {version}")
"""Combine all coverage partial files and generate JSON report."""
print_standard_logs(session)

session.install(".[test]")
session.run("python", "-m", "coverage", "combine")
Expand All @@ -30,10 +30,16 @@ def coverage_combine_and_report(session: nox.Session) -> None:

@nox.session()
def mypy_check(session: nox.Session) -> None:
version = session.run("python", "--version", silent=True)
session.log(f"Running from: {session.bin}")
session.log(f"Running with: {version}")
"""Run mypy against package and all required dependencies."""
print_standard_logs(session)

session.install(".")
session.install("mypy")
session.run("mypy", "-p", MODULE_NAME, "--no-incremental")


def print_standard_logs(session: nox.Session) -> None:
"""Reusable output for monitoring environment factors."""
version = session.run("python", "--version", silent=True)
session.log(f"Running from: {session.bin}")
session.log(f"Running with: {version}")
2 changes: 1 addition & 1 deletion requirements/requirements-test.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Testing Requirements - pytest, tox, etc.
# Testing Requirements
# ----------------------------------------
# Ensure to set PIP_INDEX_URL to the correct value for your environment
# This is the URL to the Artifactory instance that hosts the Python packages (default: pypi.org)
Expand Down