move webpush and blurhash deps out of test deps

updated ci, tox, test docs accordingly
updated tests to skip when deps are not present
pull/339/head
codl 2023-04-25 14:18:36 +02:00
rodzic 88e838c7f0
commit b08a15e9d9
6 zmienionych plików z 15 dodań i 17 usunięć

Wyświetl plik

@ -7,7 +7,7 @@ jobs:
- checkout - checkout
- run: - run:
name: "Install test deps" name: "Install test deps"
command: "pip install .[test]" command: "pip install .[test,webpush,blurhash]"
- run: - run:
name: "Run tests" name: "Run tests"
command: "python setup.py pytest --addopts '--junitxml=tests/result.xml'" command: "python setup.py pytest --addopts '--junitxml=tests/result.xml'"
@ -20,7 +20,7 @@ jobs:
- checkout - checkout
- run: - run:
name: "Install test deps" name: "Install test deps"
command: "pip install .[test]" command: "pip install .[test,webpush,blurhash]"
- run: - run:
name: "Run tests" name: "Run tests"
command: "python setup.py pytest --addopts '--junitxml=tests/result.xml'" command: "python setup.py pytest --addopts '--junitxml=tests/result.xml'"
@ -33,7 +33,7 @@ jobs:
- checkout - checkout
- run: - run:
name: "Install test deps" name: "Install test deps"
command: "pip install .[test]" command: "pip install .[test,webpush,blurhash]"
- run: - run:
name: "Install codecov" name: "Install codecov"
command: "pip install codecov" command: "pip install codecov"
@ -52,7 +52,7 @@ jobs:
- checkout - checkout
- run: - run:
name: "Install test deps" name: "Install test deps"
command: "pip install .[test]" command: "pip install .[test,webpush,blurhash]"
- run: - run:
name: "Run tests" name: "Run tests"
command: "python setup.py pytest --addopts '--junitxml=tests/result.xml'" command: "python setup.py pytest --addopts '--junitxml=tests/result.xml'"
@ -65,7 +65,7 @@ jobs:
- checkout - checkout
- run: - run:
name: "Install test deps" name: "Install test deps"
command: "pip install .[test]" command: "pip install .[test,webpush,blurhash]"
- run: - run:
name: "Run tests" name: "Run tests"
command: "python setup.py pytest --addopts '--junitxml=tests/result.xml'" command: "python setup.py pytest --addopts '--junitxml=tests/result.xml'"
@ -79,4 +79,3 @@ workflows:
- run-tests-38-cov - run-tests-38-cov
- run-tests-39 - run-tests-39
- run-tests-310 - run-tests-310

Wyświetl plik

@ -32,22 +32,13 @@ dependencies = [
[project.optional-dependencies] [project.optional-dependencies]
webpush = [ webpush = [
# when adding/updating deps, don't forget to update the test deps
'http_ece>=1.0.5', 'http_ece>=1.0.5',
'cryptography>=1.6.0', 'cryptography>=1.6.0',
] ]
blurhash = [ blurhash = [
# when adding/updating deps, don't forget to update the test deps
'blurhash>=1.1.4', 'blurhash>=1.1.4',
] ]
test = [ test = [
# webpush deps
'http_ece>=1.0.5',
'cryptography>=1.6.0',
# blurhash deps
'blurhash>=1.1.4',
'pytest', 'pytest',
'pytest-runner', 'pytest-runner',
'pytest-cov', 'pytest-cov',

Wyświetl plik

@ -2,7 +2,7 @@
To run this test suite, install the testing dependencies: To run this test suite, install the testing dependencies:
pip install -e .[test] pip install -e .[test,webpush,blurhash]
Then, run `pytest`. Then, run `pytest`.

Wyświetl plik

@ -1,5 +1,9 @@
import pytest 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): def test_blurhash_decode(api):
fake_media_dict = { fake_media_dict = {
'width': 320, 'width': 320,

Wyświetl plik

@ -2,6 +2,10 @@ import pytest
import time import time
from mastodon.Mastodon import MastodonNotFoundError 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): def test_decrypt(api):
priv = { priv = {
'auth': b'\xe7y\x0fp\xb9\x92\xe0\xa0\xc5\xd5~Qr\xd7\xaa\x16', 'auth': b'\xe7y\x0fp\xb9\x92\xe0\xa0\xc5\xd5~Qr\xd7\xaa\x16',

Wyświetl plik

@ -4,5 +4,5 @@ skipsdist = true
[testenv] [testenv]
deps = .[test] deps = .[test,webpush,blurhash]
commands = python setup.py test commands = python setup.py test