diff --git a/requirements-testing.txt b/requirements-testing.txt index a6041972cd..3008342626 100644 --- a/requirements-testing.txt +++ b/requirements-testing.txt @@ -6,7 +6,6 @@ pytest-forked pytest-localserver pytest-timeout pytest-watch -jsonschema executing asttokens responses diff --git a/scripts/populate_tox/tox.jinja b/scripts/populate_tox/tox.jinja index 40426d30fb..5abadfe281 100644 --- a/scripts/populate_tox/tox.jinja +++ b/scripts/populate_tox/tox.jinja @@ -79,6 +79,7 @@ deps = # === Common === py3.8-common: hypothesis + common: jsonschema common: pytest-asyncio common: httpcore[asyncio] # See https://github.com/pytest-dev/pytest/issues/9621 @@ -97,6 +98,7 @@ deps = # for justification of the upper bound on pytest {py3.6,py3.7}-gevent: pytest<7.0.0 {py3.8,py3.9,py3.10,py3.11,py3.12}-gevent: pytest + gevent: jsonschema gevent: pytest-asyncio gevent: setuptools<82 {py3.10,py3.11}-gevent: zope.event<5.0.0 diff --git a/tests/conftest.py b/tests/conftest.py index 11abd66e46..8f971ebfe5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,7 +14,12 @@ from urllib.parse import parse_qs, urlparse import brotli -import jsonschema + +try: + import jsonschema +except ImportError: + jsonschema = None + import pytest from pytest_localserver.http import WSGIServer from werkzeug.wrappers import Request, Response @@ -232,6 +237,7 @@ def _capture_internal_warnings(): @pytest.fixture def validate_event_schema(tmpdir): def inner(event): + assert jsonschema is not None if SENTRY_EVENT_SCHEMA: jsonschema.validate(instance=event, schema=SENTRY_EVENT_SCHEMA) diff --git a/tox.ini b/tox.ini index e91115d32e..f17f9ae8e4 100644 --- a/tox.ini +++ b/tox.ini @@ -402,6 +402,7 @@ deps = # === Common === py3.8-common: hypothesis + common: jsonschema common: pytest-asyncio common: httpcore[asyncio] # See https://github.com/pytest-dev/pytest/issues/9621 @@ -420,6 +421,7 @@ deps = # for justification of the upper bound on pytest {py3.6,py3.7}-gevent: pytest<7.0.0 {py3.8,py3.9,py3.10,py3.11,py3.12}-gevent: pytest + gevent: jsonschema gevent: pytest-asyncio gevent: setuptools<82 {py3.10,py3.11}-gevent: zope.event<5.0.0