From b08a15e9d95eecdd1bc8b6cd005d222458fb4339 Mon Sep 17 00:00:00 2001 From: codl Date: Tue, 25 Apr 2023 14:18:36 +0200 Subject: [PATCH] move webpush and blurhash deps out of test deps updated ci, tox, test docs accordingly updated tests to skip when deps are not present --- .circleci/config.yml | 11 +++++------ pyproject.toml | 9 --------- tests/README.markdown | 2 +- tests/test_blurhash.py | 4 ++++ tests/test_push.py | 4 ++++ tox.ini | 2 +- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e1ff383..dfce7b2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: - checkout - run: name: "Install test deps" - command: "pip install .[test]" + command: "pip install .[test,webpush,blurhash]" - run: name: "Run tests" command: "python setup.py pytest --addopts '--junitxml=tests/result.xml'" @@ -20,7 +20,7 @@ jobs: - checkout - run: name: "Install test deps" - command: "pip install .[test]" + command: "pip install .[test,webpush,blurhash]" - run: name: "Run tests" command: "python setup.py pytest --addopts '--junitxml=tests/result.xml'" @@ -33,7 +33,7 @@ jobs: - checkout - run: name: "Install test deps" - command: "pip install .[test]" + command: "pip install .[test,webpush,blurhash]" - run: name: "Install codecov" command: "pip install codecov" @@ -52,7 +52,7 @@ jobs: - checkout - run: name: "Install test deps" - command: "pip install .[test]" + command: "pip install .[test,webpush,blurhash]" - run: name: "Run tests" command: "python setup.py pytest --addopts '--junitxml=tests/result.xml'" @@ -65,7 +65,7 @@ jobs: - checkout - run: name: "Install test deps" - command: "pip install .[test]" + command: "pip install .[test,webpush,blurhash]" - run: name: "Run tests" command: "python setup.py pytest --addopts '--junitxml=tests/result.xml'" @@ -79,4 +79,3 @@ workflows: - run-tests-38-cov - run-tests-39 - run-tests-310 - \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index f01770d..5619e46 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,22 +32,13 @@ dependencies = [ [project.optional-dependencies] webpush = [ - # when adding/updating deps, don't forget to update the test deps 'http_ece>=1.0.5', 'cryptography>=1.6.0', ] blurhash = [ - # when adding/updating deps, don't forget to update the test deps 'blurhash>=1.1.4', ] test = [ - # webpush deps - 'http_ece>=1.0.5', - 'cryptography>=1.6.0', - - # blurhash deps - 'blurhash>=1.1.4', - 'pytest', 'pytest-runner', 'pytest-cov', diff --git a/tests/README.markdown b/tests/README.markdown index 49bf894..7cb7636 100644 --- a/tests/README.markdown +++ b/tests/README.markdown @@ -2,7 +2,7 @@ To run this test suite, install the testing dependencies: - pip install -e .[test] + pip install -e .[test,webpush,blurhash] Then, run `pytest`. diff --git a/tests/test_blurhash.py b/tests/test_blurhash.py index 3676f8f..caf8d60 100644 --- a/tests/test_blurhash.py +++ b/tests/test_blurhash.py @@ -1,5 +1,9 @@ import pytest +import mastodon.compat +if not mastodon.compat.IMPL_HAS_BLURHASH: + pytest.skip("blurhash dependencies missing, skipping blurhash tests", allow_module_level=True) + def test_blurhash_decode(api): fake_media_dict = { 'width': 320, diff --git a/tests/test_push.py b/tests/test_push.py index b815910..e9a5b72 100644 --- a/tests/test_push.py +++ b/tests/test_push.py @@ -2,6 +2,10 @@ import pytest import time from mastodon.Mastodon import MastodonNotFoundError +import mastodon.compat +if not mastodon.compat.IMPL_HAS_CRYPTO or not mastodon.compat.IMPL_HAS_ECE: + pytest.skip("webpush dependencies missing, skipping webpush tests", allow_module_level=True) + def test_decrypt(api): priv = { 'auth': b'\xe7y\x0fp\xb9\x92\xe0\xa0\xc5\xd5~Qr\xd7\xaa\x16', diff --git a/tox.ini b/tox.ini index 69cd684..c7f40dc 100644 --- a/tox.ini +++ b/tox.ini @@ -4,5 +4,5 @@ skipsdist = true [testenv] -deps = .[test] +deps = .[test,webpush,blurhash] commands = python setup.py test