diff --git a/.github/workflows/test-integrations-common.yml b/.github/workflows/test-integrations-common.yml index eb5dde8b17..7d4a9a9566 100644 --- a/.github/workflows/test-integrations-common.yml +++ b/.github/workflows/test-integrations-common.yml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13"] + python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13","3.14"] # python3.6 reached EOL and is no longer being supported on # new versions of hosted runners on Github Actions # ubuntu-20.04 is the last version that supported python3.6 diff --git a/.github/workflows/test-integrations-misc.yml b/.github/workflows/test-integrations-misc.yml index 2aaf2f07fe..365f0f47bc 100644 --- a/.github/workflows/test-integrations-misc.yml +++ b/.github/workflows/test-integrations-misc.yml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13"] + python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13","3.14"] # python3.6 reached EOL and is no longer being supported on # new versions of hosted runners on Github Actions # ubuntu-20.04 is the last version that supported python3.6 diff --git a/.github/workflows/test-integrations-web-2.yml b/.github/workflows/test-integrations-web-2.yml index 98cf4456e8..699915c387 100644 --- a/.github/workflows/test-integrations-web-2.yml +++ b/.github/workflows/test-integrations-web-2.yml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13"] + python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13","3.14"] # python3.6 reached EOL and is no longer being supported on # new versions of hosted runners on Github Actions # ubuntu-20.04 is the last version that supported python3.6 diff --git a/scripts/populate_tox/tox.jinja b/scripts/populate_tox/tox.jinja index b86da57c24..ccf4c0e98b 100755 --- a/scripts/populate_tox/tox.jinja +++ b/scripts/populate_tox/tox.jinja @@ -18,7 +18,7 @@ requires = virtualenv<20.26.3 envlist = # === Common === - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common + {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13,py3.14}-common # === Gevent === {py3.6,py3.8,py3.10,py3.11,py3.12}-gevent @@ -26,7 +26,7 @@ envlist = # === Integrations === # Asgi - {py3.7,py3.12,py3.13}-asgi + {py3.7,py3.12,py3.13,py3.14}-asgi # AWS Lambda {py3.8,py3.9,py3.11,py3.13}-aws_lambda @@ -38,7 +38,7 @@ envlist = {py3.7}-gcp # OpenTelemetry (OTel) - {py3.7,py3.9,py3.12,py3.13}-opentelemetry + {py3.7,py3.9,py3.12,py3.13,py3.14}-opentelemetry # OpenTelemetry Experimental (POTel) {py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-potel @@ -74,7 +74,7 @@ deps = # and https://github.com/pytest-dev/pytest-forked/issues/67 # for justification of the upper bound on pytest {py3.6,py3.7}-common: pytest<7.0.0 - {py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common: pytest + {py3.8,py3.9,py3.10,py3.11,py3.12,py3.13,py3.14}-common: pytest # === Gevent === {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-gevent: gevent>=22.10.0, <22.11.0 @@ -177,6 +177,7 @@ basepython = py3.11: python3.11 py3.12: python3.12 py3.13: python3.13 + py3.14: python3.14 # Python version is pinned here for consistency across environments. # Tools like ruff and mypy have options that pin the target Python diff --git a/tests/conftest.py b/tests/conftest.py index faa0251d9b..ebb4bba95f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -57,17 +57,6 @@ with open(SENTRY_EVENT_SCHEMA) as f: SENTRY_EVENT_SCHEMA = json.load(f) -try: - import pytest_benchmark -except ImportError: - - @pytest.fixture - def benchmark(): - return lambda x: x() - -else: - del pytest_benchmark - from sentry_sdk import scope diff --git a/tests/test_client.py b/tests/test_client.py index ff3f61d702..a5b0b44931 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -751,7 +751,7 @@ def test_cyclic_data(sentry_init, capture_events): assert data == {"not_cyclic2": "", "not_cyclic": "", "is_cyclic": ""} -def test_databag_depth_stripping(sentry_init, capture_events, benchmark): +def test_databag_depth_stripping(sentry_init, capture_events): sentry_init() events = capture_events() @@ -759,58 +759,71 @@ def test_databag_depth_stripping(sentry_init, capture_events, benchmark): for _ in range(100000): value = [value] - @benchmark - def inner(): - del events[:] - try: - a = value # noqa - 1 / 0 - except Exception: - capture_exception() + del events[:] + try: + a = value # noqa + 1 / 0 + except Exception: + capture_exception() + + (event,) = events + + stacktrace_frame = event["exception"]["values"][0]["stacktrace"]["frames"][0] + a_var = stacktrace_frame["vars"]["a"] + + assert type(a_var) == list + assert len(a_var) == 1 and type(a_var[0]) == list + + first_level_list = a_var[0] + assert type(first_level_list) == list + assert len(first_level_list) == 1 + + second_level_list = first_level_list[0] + assert type(second_level_list) == list + assert len(second_level_list) == 1 - (event,) = events + third_level_list = second_level_list[0] + assert type(third_level_list) == list + assert len(third_level_list) == 1 - assert len(json.dumps(event)) < 10000 + inner_value_repr = third_level_list[0] + assert type(inner_value_repr) == str -def test_databag_string_stripping(sentry_init, capture_events, benchmark): +def test_databag_string_stripping(sentry_init, capture_events): sentry_init() events = capture_events() - @benchmark - def inner(): - del events[:] - try: - a = "A" * DEFAULT_MAX_VALUE_LENGTH * 10 # noqa - 1 / 0 - except Exception: - capture_exception() + del events[:] + try: + a = "A" * DEFAULT_MAX_VALUE_LENGTH * 10 # noqa + 1 / 0 + except Exception: + capture_exception() - (event,) = events + (event,) = events - assert len(json.dumps(event)) < DEFAULT_MAX_VALUE_LENGTH * 10 + assert len(json.dumps(event)) < DEFAULT_MAX_VALUE_LENGTH * 10 -def test_databag_breadth_stripping(sentry_init, capture_events, benchmark): +def test_databag_breadth_stripping(sentry_init, capture_events): sentry_init() events = capture_events() - @benchmark - def inner(): - del events[:] - try: - a = ["a"] * 1000000 # noqa - 1 / 0 - except Exception: - capture_exception() + del events[:] + try: + a = ["a"] * 1000000 # noqa + 1 / 0 + except Exception: + capture_exception() - (event,) = events + (event,) = events - assert ( - len(event["exception"]["values"][0]["stacktrace"]["frames"][0]["vars"]["a"]) - == MAX_DATABAG_BREADTH - ) - assert len(json.dumps(event)) < 10000 + assert ( + len(event["exception"]["values"][0]["stacktrace"]["frames"][0]["vars"]["a"]) + == MAX_DATABAG_BREADTH + ) + assert len(json.dumps(event)) < 10000 def test_chained_exceptions(sentry_init, capture_events): diff --git a/tox.ini b/tox.ini index dee0d83365..b5e4ec21e5 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ requires = virtualenv<20.26.3 envlist = # === Common === - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common + {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13,py3.14}-common # === Gevent === {py3.6,py3.8,py3.10,py3.11,py3.12}-gevent @@ -26,7 +26,7 @@ envlist = # === Integrations === # Asgi - {py3.7,py3.12,py3.13}-asgi + {py3.7,py3.12,py3.13,py3.14}-asgi # AWS Lambda {py3.8,py3.9,py3.11,py3.13}-aws_lambda @@ -38,7 +38,7 @@ envlist = {py3.7}-gcp # OpenTelemetry (OTel) - {py3.7,py3.9,py3.12,py3.13}-opentelemetry + {py3.7,py3.9,py3.12,py3.13,py3.14}-opentelemetry # OpenTelemetry Experimental (POTel) {py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-potel @@ -304,7 +304,7 @@ deps = # and https://github.com/pytest-dev/pytest-forked/issues/67 # for justification of the upper bound on pytest {py3.6,py3.7}-common: pytest<7.0.0 - {py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common: pytest + {py3.8,py3.9,py3.10,py3.11,py3.12,py3.13,py3.14}-common: pytest # === Gevent === {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-gevent: gevent>=22.10.0, <22.11.0 @@ -825,6 +825,7 @@ basepython = py3.11: python3.11 py3.12: python3.12 py3.13: python3.13 + py3.14: python3.14 # Python version is pinned here for consistency across environments. # Tools like ruff and mypy have options that pin the target Python