Skip to content

Commit

Permalink
Use nox (#223)
Browse files Browse the repository at this point in the history
* 🧑‍💻 Add term cov

* 🔥 Remove tox.ini

* 🔧 Add noxfile

* 🔧 Replace tox with nox

* 👷 Use nox in CI

* 🧑‍💻 Reorder sessions

* 🦺 Check noxfile.py

* 👷 Fix CI

* 👷 Fix python version
  • Loading branch information
EarlMilktea authored Oct 14, 2024
1 parent f026a19 commit 90c9433
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Before submitting, please check the following:

- Make sure you have tests for the new code and that test passes (run `tox`)
- Make sure you have tests for the new code and that test passes (run `nox`)
- If applicable, add a line to the [unreleased] part of CHANGELOG.md, following [keep-a-changelog](https://keepachangelog.com/en/1.0.0/).
- Format added code by `ruff`
- See `CONTRIBUTING.md` for more details
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Upgrade pip
run: python -m pip install --upgrade pip
- run: python -m pip install --upgrade pip

- name: Install tox
run: pip install tox tox-gh-actions
- name: Setup nox
# Keep in sync with requirements-dev.txt
uses: wntrblm/[email protected]

- name: Run tox
run: tox
- run: nox --python ${{ matrix.python }}
2 changes: 1 addition & 1 deletion .github/workflows/cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: pip install .[dev]

- name: Run pytest
run: pytest --cov=./graphix --cov-report=xml
run: pytest --cov=./graphix --cov-report=xml --cov-report=term

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
Expand Down
21 changes: 21 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Run tests with nox."""

from __future__ import annotations

import nox
from nox import Session


@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
def tests_minimal(session: Session) -> None:
"""Run the test suite with minimal dependencies."""
session.install("-e", ".")
session.install("pytest", "pytest-mock", "psutil")
session.run("pytest")


@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
def tests(session: Session) -> None:
"""Run the test suite with full dependencies."""
session.install("-e", ".[dev]")
session.run("pytest")
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ files = [
"graphix/states.py",
"graphix/type_utils.py",
"graphix/_db.py",
"noxfile.py",
"tests/conftest.py",
"tests/test_clifford.py",
"tests/test_db.py",
Expand All @@ -133,6 +134,7 @@ include = [
"graphix/states.py",
"graphix/type_utils.py",
"graphix/_db.py",
"noxfile.py",
"tests/conftest.py",
"tests/test_clifford.py",
"tests/test_db.py",
Expand Down
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ types-networkx
types-psutil

# Tests
# Keep in sync with CI
nox==2024.10.09
psutil
pytest
pytest-cov
pytest-mock
tox

# Optional dependencies
qiskit>=1.0
Expand Down
28 changes: 0 additions & 28 deletions tox.ini

This file was deleted.

0 comments on commit 90c9433

Please sign in to comment.