From 2a5dedcbb531bcec89eab940d36f66ac5b2dd9ae Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Mon, 4 Dec 2023 22:03:56 +0300 Subject: [PATCH] ci: refactor pytests dev dependencies --- .github/workflows/benches.yml | 2 +- noxfile.py | 3 +-- pytests/noxfile.py | 5 ++--- pytests/pyo3_pytests/__init__.py | 1 - pytests/pyproject.toml | 9 +++++++++ pytests/requirements-dev.txt | 5 ----- 6 files changed, 13 insertions(+), 12 deletions(-) delete mode 100644 pytests/pyo3_pytests/__init__.py delete mode 100644 pytests/requirements-dev.txt diff --git a/.github/workflows/benches.yml b/.github/workflows/benches.yml index a6032284..742af7b3 100644 --- a/.github/workflows/benches.yml +++ b/.github/workflows/benches.yml @@ -36,7 +36,7 @@ jobs: run: pip install nox - name: Run the benchmarks - uses: CodSpeedHQ/action@v1 + uses: CodSpeedHQ/action@v2 with: run: nox -s codspeed token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/noxfile.py b/noxfile.py index c91f5b57..9d9810b1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -140,8 +140,7 @@ def codspeed(session: nox.Session) -> bool: _run_cargo(session, "codspeed", "run") # python benchmarks os.chdir(PYO3_DIR / "pytests") - session.install("-r", "requirements-dev.txt", "pytest-codspeed") - session.install(".") + session.install(".[dev]", "pytest-codspeed") _run(session, "pytest", "--codspeed", external=True) diff --git a/pytests/noxfile.py b/pytests/noxfile.py index bab55868..7588e966 100644 --- a/pytests/noxfile.py +++ b/pytests/noxfile.py @@ -6,7 +6,7 @@ nox.options.sessions = ["test"] @nox.session def test(session: nox.Session): - session.install("-rrequirements-dev.txt") + session.install(".[dev]") try: session.install("--only-binary=numpy", "numpy>=1.16") except CommandFailed: @@ -19,6 +19,5 @@ def test(session: nox.Session): @nox.session def bench(session: nox.Session): - session.install("-rrequirements-dev.txt") - session.install(".") + session.install(".[dev]") session.run("pytest", "--benchmark-enable", "--benchmark-only", *session.posargs) diff --git a/pytests/pyo3_pytests/__init__.py b/pytests/pyo3_pytests/__init__.py deleted file mode 100644 index b9d3a92f..00000000 --- a/pytests/pyo3_pytests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .pyo3_pytests import * diff --git a/pytests/pyproject.toml b/pytests/pyproject.toml index dfebfe31..fb1ac3db 100644 --- a/pytests/pyproject.toml +++ b/pytests/pyproject.toml @@ -17,3 +17,12 @@ classifiers = [ "Operating System :: POSIX", "Operating System :: MacOS :: MacOS X", ] + +[project.optional-dependencies] +dev = [ + "hypothesis>=3.55", + "pytest-asyncio>=0.21", + "pytest-benchmark>=3.4", + "pytest>=6.0", + "typing_extensions>=4.0.0" +] diff --git a/pytests/requirements-dev.txt b/pytests/requirements-dev.txt deleted file mode 100644 index aa0c703a..00000000 --- a/pytests/requirements-dev.txt +++ /dev/null @@ -1,5 +0,0 @@ -hypothesis>=3.55 -pytest>=6.0 -pytest-asyncio>=0.21 -pytest-benchmark>=3.4 -typing_extensions>=4.0.0