Skip to content
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

Switch to nox for automated testing #212

Merged
merged 1 commit into from
Jun 1, 2024
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
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
with:
python-version: ${{ matrix.python }}
- name: Install test dependencies
run: python -m pip install -U tox
run: python -m pip install --upgrade nox
- name: Test
run: python -m tox -e py
run: python -m nox -s tests-${{ matrix.python }}
- name: Lint
run: python -m nox -s lint
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ dist/
__pycache__/
*.so
*~
venv/

# due to using tox and pytest
.tox
# due to using nox and pytest
.nox
.cache
52 changes: 52 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# this file is *not* meant to cover or endorse the use of nox or pytest or
# testing in general,
#
# It's meant to show the use of:
#
# - check-manifest
# confirm items checked into vcs are in your sdist
# - readme_renderer (when using a reStructuredText README)
# confirms your long_description will render correctly on PyPI.
#
# and also to help confirm pull requests to this project.

import nox
import os

nox.options.sessions = ["lint"]

# Define the minimal nox version required to run
nox.options.needs_version = ">= 2024.3.2"


@nox.session
def lint(session):
session.install("flake8")
session.run(
"flake8", "--exclude", ".nox,*.egg,build,data",
"--select", "E,W,F", "."
)


@nox.session
def build_and_check_dists(session):
session.install("build", "check-manifest >= 0.42", "twine")
# If your project uses README.rst, uncomment the following:
# session.install("readme_renderer")

session.run("check-manifest", "--ignore", "noxfile.py,tests/**")
session.run("python", "-m", "build")
session.run("python", "-m", "twine", "check", "dist/*")


@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
def tests(session):
session.install("pytest")
build_and_check_dists(session)

generated_files = os.listdir("dist/")
generated_sdist = os.path.join("dist/", generated_files[1])

session.install(generated_sdist)

session.run("py.test", "tests/", *session.posargs)
45 changes: 0 additions & 45 deletions tox.ini

This file was deleted.

Loading