From 117f44939318726911a172f7fedaee6272f7bcab Mon Sep 17 00:00:00 2001 From: "Mike A." Date: Mon, 2 Sep 2024 21:12:44 +0200 Subject: [PATCH 1/6] tests: Add very basic unit tests --- noxfile.py | 41 +++++++++++++++ poetry.lock | 117 ++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 3 ++ tests/test_keygen.py | 11 ++++ 4 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 noxfile.py create mode 100644 tests/test_keygen.py diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 0000000..d3ad898 --- /dev/null +++ b/noxfile.py @@ -0,0 +1,41 @@ +"""Configuration file for Nox.""" + +from itertools import count +from pathlib import Path +from typing import Generator + +import nox +import tomllib +from packaging.specifiers import SpecifierSet +from packaging.version import Version + + +def get_python_versions() -> Generator[str, None, None]: + """Get all python versions this package is compatible with.""" + with Path("pyproject.toml").open("rb") as f: + pyproject_data = tomllib.load(f) + + specifier = SpecifierSet(pyproject_data["tool"]["poetry"]["dependencies"]["python"]) + + below_spec = True + for v_minor in count(): + version = Version(f"3.{v_minor}") + + # in specifier: yield + if version in specifier: + below_spec = False + yield str(version) + continue + + # below specifier: skip + if below_spec: + continue + + # above specifier: return + return + + +@nox.session(python=list(get_python_versions())) +def test(session: nox.Session) -> None: + """Run unit tests.""" + session.run("pytest") diff --git a/poetry.lock b/poetry.lock index e57bc95..b1eba19 100644 --- a/poetry.lock +++ b/poetry.lock @@ -133,6 +133,20 @@ files = [ {file = "alabaster-0.7.16.tar.gz", hash = "sha256:75a8b99c28a5dad50dd7f8ccdd447a121ddb3892da9e53d1ca5cca3106d58d65"}, ] +[[package]] +name = "argcomplete" +version = "3.5.0" +description = "Bash tab completion for argparse" +optional = false +python-versions = ">=3.8" +files = [ + {file = "argcomplete-3.5.0-py3-none-any.whl", hash = "sha256:d4bcf3ff544f51e16e54228a7ac7f486ed70ebf2ecfe49a63a91171c76bf029b"}, + {file = "argcomplete-3.5.0.tar.gz", hash = "sha256:4349400469dccfb7950bb60334a680c58d88699bff6159df61251878dc6bf74b"}, +] + +[package.extras] +test = ["coverage", "mypy", "pexpect", "ruff", "wheel"] + [[package]] name = "astroid" version = "3.2.4" @@ -456,6 +470,23 @@ files = [ {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] +[[package]] +name = "colorlog" +version = "6.8.2" +description = "Add colours to the output of Python's logging module." +optional = false +python-versions = ">=3.6" +files = [ + {file = "colorlog-6.8.2-py3-none-any.whl", hash = "sha256:4dcbb62368e2800cb3c5abd348da7e53f6c362dda502ec27c560b2e58a66bd33"}, + {file = "colorlog-6.8.2.tar.gz", hash = "sha256:3e3e079a41feb5a1b64f978b5ea4f46040a94f11f0e8bbb8261e3dbbeca64d44"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} + +[package.extras] +development = ["black", "flake8", "mypy", "pytest", "types-colorama"] + [[package]] name = "cryptography" version = "43.0.0" @@ -564,6 +595,20 @@ files = [ {file = "docutils-0.21.2.tar.gz", hash = "sha256:3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f"}, ] +[[package]] +name = "exceptiongroup" +version = "1.2.2" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, +] + +[package.extras] +test = ["pytest (>=6)"] + [[package]] name = "filelock" version = "3.15.4" @@ -721,6 +766,17 @@ doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linke perf = ["ipython"] test = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-perf (>=0.9.2)", "pytest-ruff (>=0.2.1)"] +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + [[package]] name = "jinja2" version = "3.1.4" @@ -917,6 +973,28 @@ files = [ {file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"}, ] +[[package]] +name = "nox" +version = "2024.4.15" +description = "Flexible test automation." +optional = false +python-versions = ">=3.7" +files = [ + {file = "nox-2024.4.15-py3-none-any.whl", hash = "sha256:6492236efa15a460ecb98e7b67562a28b70da006ab0be164e8821177577c0565"}, + {file = "nox-2024.4.15.tar.gz", hash = "sha256:ecf6700199cdfa9e5ea0a41ff5e6ef4641d09508eda6edb89d9987864115817f"}, +] + +[package.dependencies] +argcomplete = ">=1.9.4,<4.0" +colorlog = ">=2.6.1,<7.0.0" +packaging = ">=20.9" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} +virtualenv = ">=20.14.1" + +[package.extras] +tox-to-nox = ["jinja2", "tox"] +uv = ["uv (>=0.1.6)"] + [[package]] name = "packaging" version = "24.1" @@ -944,6 +1022,21 @@ docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx- test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] type = ["mypy (>=1.8)"] +[[package]] +name = "pluggy" +version = "1.5.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + [[package]] name = "pre-commit" version = "3.8.0" @@ -1081,6 +1174,28 @@ nodeenv = ">=1.6.0" all = ["twine (>=3.4.1)"] dev = ["twine (>=3.4.1)"] +[[package]] +name = "pytest" +version = "8.3.2" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest-8.3.2-py3-none-any.whl", hash = "sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5"}, + {file = "pytest-8.3.2.tar.gz", hash = "sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=1.5,<2" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} + +[package.extras] +dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + [[package]] name = "pyyaml" version = "6.0.1" @@ -1787,4 +1902,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.13" -content-hash = "149d6290c83176f706f1d5e34804561ff862e2ada5b1b7a55b29d44ef3d65af0" +content-hash = "a5d2963bf409939c80dd04f6c13beda52175b5dbd7b0de08b21605b94d6b58b6" diff --git a/pyproject.toml b/pyproject.toml index cc9dabc..2655d29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,8 @@ sphinx = "^7.2.6" sphinx-autoapi = "^3.2.1" pyright = "^1.1.374" ruff = "0.5.6" +nox = "^2024.4.15" +pytest = "^8.3.2" [tool.pyright] venvPath = "." @@ -32,6 +34,7 @@ reportImplicitOverride = true [tool.ruff] exclude = [ "docs/", + "tests/" ] select = [ diff --git a/tests/test_keygen.py b/tests/test_keygen.py new file mode 100644 index 0000000..3b51e6e --- /dev/null +++ b/tests/test_keygen.py @@ -0,0 +1,11 @@ +import pytest + + +@pytest.mark.parametrize('execution_number', range(100)) +def test_import(execution_number): + import findmy + + kp = findmy.KeyPair.new() + assert len(kp.private_key_bytes) == 28 + assert len(kp.adv_key_bytes) == 28 + assert len(kp.hashed_adv_key_bytes) == 32 From 51c7448a1c836a27f1680578a49110699623386d Mon Sep 17 00:00:00 2001 From: "Mike A." Date: Mon, 2 Sep 2024 21:16:18 +0200 Subject: [PATCH 2/6] tests: Use tomli instead of tomllib --- noxfile.py | 4 ++-- poetry.lock | 2 +- pyproject.toml | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index d3ad898..eac57c0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -5,7 +5,7 @@ from typing import Generator import nox -import tomllib +import tomli from packaging.specifiers import SpecifierSet from packaging.version import Version @@ -13,7 +13,7 @@ def get_python_versions() -> Generator[str, None, None]: """Get all python versions this package is compatible with.""" with Path("pyproject.toml").open("rb") as f: - pyproject_data = tomllib.load(f) + pyproject_data = tomli.load(f) specifier = SpecifierSet(pyproject_data["tool"]["poetry"]["dependencies"]["python"]) diff --git a/poetry.lock b/poetry.lock index b1eba19..66b8204 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1902,4 +1902,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.13" -content-hash = "a5d2963bf409939c80dd04f6c13beda52175b5dbd7b0de08b21605b94d6b58b6" +content-hash = "cf83e5ed90b7d2c8a905221b890c914f921ef25340aacb54d8c6a9f042ae9fde" diff --git a/pyproject.toml b/pyproject.toml index 2655d29..ae61fc2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ pyright = "^1.1.374" ruff = "0.5.6" nox = "^2024.4.15" pytest = "^8.3.2" +tomli = "^2.0.1" [tool.pyright] venvPath = "." From 0f015f6880e5810252f4789ec800e1577b2bbd67 Mon Sep 17 00:00:00 2001 From: Mike Almeloo Date: Mon, 2 Sep 2024 21:22:12 +0200 Subject: [PATCH 3/6] tests: add actions workflow --- .github/workflows/test.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7ec3637 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,28 @@ +name: Run unit tests + +on: + workflow_dispatch: + push: + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install poetry + poetry config virtualenvs.in-project true + poetry install + + - uses: wntrblm/nox@2024.04.15 + + - name: Run unit tests + run: nox From 3facf5cd2762340615674309ec0087ab091f5326 Mon Sep 17 00:00:00 2001 From: "Mike A." Date: Mon, 2 Sep 2024 21:29:43 +0200 Subject: [PATCH 4/6] tests: Adapt for poetry --- .github/workflows/test.yml | 2 +- noxfile.py | 6 +++--- poetry.lock | 29 ++++++++++++++++++++++++++++- pyproject.toml | 1 + 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7ec3637..9b5faa6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,4 +25,4 @@ jobs: - uses: wntrblm/nox@2024.04.15 - name: Run unit tests - run: nox + run: poetry run nox diff --git a/noxfile.py b/noxfile.py index eac57c0..9de65c1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -4,7 +4,7 @@ from pathlib import Path from typing import Generator -import nox +import nox_poetry import tomli from packaging.specifiers import SpecifierSet from packaging.version import Version @@ -35,7 +35,7 @@ def get_python_versions() -> Generator[str, None, None]: return -@nox.session(python=list(get_python_versions())) -def test(session: nox.Session) -> None: +@nox_poetry.session(python=list(get_python_versions())) +def test(session: nox_poetry.Session) -> None: """Run unit tests.""" session.run("pytest") diff --git a/poetry.lock b/poetry.lock index 66b8204..aa9a75d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -995,6 +995,22 @@ virtualenv = ">=20.14.1" tox-to-nox = ["jinja2", "tox"] uv = ["uv (>=0.1.6)"] +[[package]] +name = "nox-poetry" +version = "1.0.3" +description = "nox-poetry" +optional = false +python-versions = ">=3.7,<4.0" +files = [ + {file = "nox_poetry-1.0.3-py3-none-any.whl", hash = "sha256:a2fffeb70ae81840479e68287afe1c772bf376f70f1e92f99832a20b3c64d064"}, + {file = "nox_poetry-1.0.3.tar.gz", hash = "sha256:dc7ecbbd812a333a0c0b558f57e5b37f7c12926cddbcecaf2264957fd373824e"}, +] + +[package.dependencies] +nox = ">=2020.8.22" +packaging = ">=20.9" +tomlkit = ">=0.7" + [[package]] name = "packaging" version = "24.1" @@ -1515,6 +1531,17 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] +[[package]] +name = "tomlkit" +version = "0.13.2" +description = "Style preserving TOML library" +optional = false +python-versions = ">=3.8" +files = [ + {file = "tomlkit-0.13.2-py3-none-any.whl", hash = "sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde"}, + {file = "tomlkit-0.13.2.tar.gz", hash = "sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79"}, +] + [[package]] name = "typing-extensions" version = "4.12.2" @@ -1902,4 +1929,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.13" -content-hash = "cf83e5ed90b7d2c8a905221b890c914f921ef25340aacb54d8c6a9f042ae9fde" +content-hash = "27690dec4a15030e8b75dfc752b57b65e496701c5f4cf0864c8b01735948bfad" diff --git a/pyproject.toml b/pyproject.toml index ae61fc2..062fb34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ ruff = "0.5.6" nox = "^2024.4.15" pytest = "^8.3.2" tomli = "^2.0.1" +nox-poetry = "^1.0.3" [tool.pyright] venvPath = "." From b2363f5f9bd40a597461f58abad927e8d0e6a947 Mon Sep 17 00:00:00 2001 From: "Mike A." Date: Mon, 2 Sep 2024 23:10:23 +0200 Subject: [PATCH 5/6] tests: Split up into separate jobs --- .github/workflows/test.yml | 37 ++++++++- poetry.lock | 82 +------------------ pyproject.toml | 6 +- .../supported_py_versions.py | 9 +- 4 files changed, 40 insertions(+), 94 deletions(-) rename noxfile.py => scripts/supported_py_versions.py (80%) mode change 100644 => 100755 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9b5faa6..8c0450f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,9 +5,12 @@ on: push: jobs: - deploy: + versions: runs-on: ubuntu-latest + outputs: + py-versions: ${{ steps.supported-versions.outputs.py-versions }} + steps: - uses: actions/checkout@v4 @@ -22,7 +25,33 @@ jobs: poetry config virtualenvs.in-project true poetry install - - uses: wntrblm/nox@2024.04.15 + - id: supported-versions + name: Get supported versions + run: echo "py-versions=$(poetry run ./scripts/supported_py_versions.py)" >> "$GITHUB_OUTPUT" + + test: + runs-on: ubuntu-latest + + needs: versions + strategy: + matrix: + py-version: ${{ fromJson(needs.versions.outputs.py-versions) }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "${{ matrix.py-version }}" + + - name: Install dependencies + run: | + python -m pip install poetry + poetry config virtualenvs.in-project true + + # Only install main dependencies + poetry install --only=test - - name: Run unit tests - run: poetry run nox + - name: Run unit tests + run: poetry run pytest diff --git a/poetry.lock b/poetry.lock index aa9a75d..f0f3886 100644 --- a/poetry.lock +++ b/poetry.lock @@ -133,20 +133,6 @@ files = [ {file = "alabaster-0.7.16.tar.gz", hash = "sha256:75a8b99c28a5dad50dd7f8ccdd447a121ddb3892da9e53d1ca5cca3106d58d65"}, ] -[[package]] -name = "argcomplete" -version = "3.5.0" -description = "Bash tab completion for argparse" -optional = false -python-versions = ">=3.8" -files = [ - {file = "argcomplete-3.5.0-py3-none-any.whl", hash = "sha256:d4bcf3ff544f51e16e54228a7ac7f486ed70ebf2ecfe49a63a91171c76bf029b"}, - {file = "argcomplete-3.5.0.tar.gz", hash = "sha256:4349400469dccfb7950bb60334a680c58d88699bff6159df61251878dc6bf74b"}, -] - -[package.extras] -test = ["coverage", "mypy", "pexpect", "ruff", "wheel"] - [[package]] name = "astroid" version = "3.2.4" @@ -470,23 +456,6 @@ files = [ {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] -[[package]] -name = "colorlog" -version = "6.8.2" -description = "Add colours to the output of Python's logging module." -optional = false -python-versions = ">=3.6" -files = [ - {file = "colorlog-6.8.2-py3-none-any.whl", hash = "sha256:4dcbb62368e2800cb3c5abd348da7e53f6c362dda502ec27c560b2e58a66bd33"}, - {file = "colorlog-6.8.2.tar.gz", hash = "sha256:3e3e079a41feb5a1b64f978b5ea4f46040a94f11f0e8bbb8261e3dbbeca64d44"}, -] - -[package.dependencies] -colorama = {version = "*", markers = "sys_platform == \"win32\""} - -[package.extras] -development = ["black", "flake8", "mypy", "pytest", "types-colorama"] - [[package]] name = "cryptography" version = "43.0.0" @@ -973,44 +942,6 @@ files = [ {file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"}, ] -[[package]] -name = "nox" -version = "2024.4.15" -description = "Flexible test automation." -optional = false -python-versions = ">=3.7" -files = [ - {file = "nox-2024.4.15-py3-none-any.whl", hash = "sha256:6492236efa15a460ecb98e7b67562a28b70da006ab0be164e8821177577c0565"}, - {file = "nox-2024.4.15.tar.gz", hash = "sha256:ecf6700199cdfa9e5ea0a41ff5e6ef4641d09508eda6edb89d9987864115817f"}, -] - -[package.dependencies] -argcomplete = ">=1.9.4,<4.0" -colorlog = ">=2.6.1,<7.0.0" -packaging = ">=20.9" -tomli = {version = ">=1", markers = "python_version < \"3.11\""} -virtualenv = ">=20.14.1" - -[package.extras] -tox-to-nox = ["jinja2", "tox"] -uv = ["uv (>=0.1.6)"] - -[[package]] -name = "nox-poetry" -version = "1.0.3" -description = "nox-poetry" -optional = false -python-versions = ">=3.7,<4.0" -files = [ - {file = "nox_poetry-1.0.3-py3-none-any.whl", hash = "sha256:a2fffeb70ae81840479e68287afe1c772bf376f70f1e92f99832a20b3c64d064"}, - {file = "nox_poetry-1.0.3.tar.gz", hash = "sha256:dc7ecbbd812a333a0c0b558f57e5b37f7c12926cddbcecaf2264957fd373824e"}, -] - -[package.dependencies] -nox = ">=2020.8.22" -packaging = ">=20.9" -tomlkit = ">=0.7" - [[package]] name = "packaging" version = "24.1" @@ -1531,17 +1462,6 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] -[[package]] -name = "tomlkit" -version = "0.13.2" -description = "Style preserving TOML library" -optional = false -python-versions = ">=3.8" -files = [ - {file = "tomlkit-0.13.2-py3-none-any.whl", hash = "sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde"}, - {file = "tomlkit-0.13.2.tar.gz", hash = "sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79"}, -] - [[package]] name = "typing-extensions" version = "4.12.2" @@ -1929,4 +1849,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.13" -content-hash = "27690dec4a15030e8b75dfc752b57b65e496701c5f4cf0864c8b01735948bfad" +content-hash = "76b9b1880395ad0de30e47b51e24d21ca6f69e96bb0eb3760e1acccdc1ae9c30" diff --git a/pyproject.toml b/pyproject.toml index 062fb34..add3ffa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,10 +20,10 @@ sphinx = "^7.2.6" sphinx-autoapi = "^3.2.1" pyright = "^1.1.374" ruff = "0.5.6" -nox = "^2024.4.15" -pytest = "^8.3.2" tomli = "^2.0.1" -nox-poetry = "^1.0.3" + +[tool.poetry.group.test.dependencies] +pytest = "^8.3.2" [tool.pyright] venvPath = "." diff --git a/noxfile.py b/scripts/supported_py_versions.py old mode 100644 new mode 100755 similarity index 80% rename from noxfile.py rename to scripts/supported_py_versions.py index 9de65c1..23c9743 --- a/noxfile.py +++ b/scripts/supported_py_versions.py @@ -1,10 +1,10 @@ -"""Configuration file for Nox.""" +#!/usr/bin/env python3 +import json from itertools import count from pathlib import Path from typing import Generator -import nox_poetry import tomli from packaging.specifiers import SpecifierSet from packaging.version import Version @@ -35,7 +35,4 @@ def get_python_versions() -> Generator[str, None, None]: return -@nox_poetry.session(python=list(get_python_versions())) -def test(session: nox_poetry.Session) -> None: - """Run unit tests.""" - session.run("pytest") +print(json.dumps(list(get_python_versions()))) From ae98d611dab15c5efdd368c00db0955109c9df9b Mon Sep 17 00:00:00 2001 From: "Mike A." Date: Mon, 2 Sep 2024 23:21:42 +0200 Subject: [PATCH 6/6] chore: Declare dependency groups as optional --- .github/workflows/docs.yml | 2 +- .github/workflows/pre-commit.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 4 ++-- poetry.lock | 2 +- pyproject.toml | 6 ++++++ 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 1f2e5fc..8e32a23 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -26,7 +26,7 @@ jobs: run: | python -m pip install poetry poetry config virtualenvs.in-project true - poetry install + poetry install --with dev - name: Build documentation run: | diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index a0f29f6..3471680 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -22,7 +22,7 @@ jobs: run: | python -m pip install poetry poetry config virtualenvs.in-project true - poetry install + poetry install --with dev - uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b5d331b..2812c62 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,7 +24,7 @@ jobs: run: | python -m pip install poetry poetry config virtualenvs.in-project true - poetry install + poetry install --with dev - name: Prepare README run: ./scripts/refactor_readme.py README.md diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c0450f..c7a0215 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: run: | python -m pip install poetry poetry config virtualenvs.in-project true - poetry install + poetry install --with dev - id: supported-versions name: Get supported versions @@ -51,7 +51,7 @@ jobs: poetry config virtualenvs.in-project true # Only install main dependencies - poetry install --only=test + poetry install --with test - name: Run unit tests run: poetry run pytest diff --git a/poetry.lock b/poetry.lock index f0f3886..ad95bc6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1849,4 +1849,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.13" -content-hash = "76b9b1880395ad0de30e47b51e24d21ca6f69e96bb0eb3760e1acccdc1ae9c30" +content-hash = "4f46b85a3182de2a998c0a9ee8403011da162789e1f43df65b35701045e07a68" diff --git a/pyproject.toml b/pyproject.toml index add3ffa..aa21f85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,9 @@ beautifulsoup4 = "^4.12.3" aiohttp = "^3.9.5" bleak = "^0.22.2" +[tool.poetry.group.dev] +optional = true + [tool.poetry.group.dev.dependencies] pre-commit = "^3.8.0" sphinx = "^7.2.6" @@ -22,6 +25,9 @@ pyright = "^1.1.374" ruff = "0.5.6" tomli = "^2.0.1" +[tool.poetry.group.test] +optional = true + [tool.poetry.group.test.dependencies] pytest = "^8.3.2"