Skip to content

Commit 74bbd38

Browse files
authored
test: Clean up tests (#7063)
- Remove `skipif`s that are not necessary anymore (because they skip running the test case against framework versions we've now dropped) - Remove flaky skipped threading test
1 parent 7fc50e9 commit 74bbd38

8 files changed

Lines changed: 0 additions & 101 deletions

File tree

tests/integrations/django/test_basic.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,6 @@ def test_render_spans(
17361736
)
17371737

17381738

1739-
@pytest.mark.skipif(DJANGO_VERSION < (1, 9), reason="Requires Django >= 1.9")
17401739
@pytest.mark.forked
17411740
@pytest_mark_django_db_decorator()
17421741
def test_render_spans_queryset_in_data(sentry_init, client, capture_events):
@@ -2123,7 +2122,6 @@ def test_csrf(sentry_init, client):
21232122
assert content == b"ok"
21242123

21252124

2126-
@pytest.mark.skipif(DJANGO_VERSION < (2, 0), reason="Requires Django > 2.0")
21272125
@pytest.mark.parametrize("middleware_spans", [False, True])
21282126
@pytest.mark.parametrize("span_streaming", [True, False])
21292127
def test_custom_urlconf_middleware(
@@ -2248,7 +2246,6 @@ def dummy(a, b):
22482246
assert name == "partial(<function " + a_partial.func.__name__ + ">)"
22492247

22502248

2251-
@pytest.mark.skipif(DJANGO_VERSION <= (1, 11), reason="Requires Django > 1.11")
22522249
@pytest.mark.parametrize("span_streaming", [True, False])
22532250
def test_span_origin(
22542251
sentry_init,

tests/integrations/django/test_cache_module.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ def use_django_caching_with_cluster(settings):
9191

9292
@pytest.mark.forked
9393
@pytest_mark_django_db_decorator()
94-
@pytest.mark.skipif(DJANGO_VERSION < (1, 9), reason="Requires Django >= 1.9")
9594
@pytest.mark.parametrize("span_streaming", [True, False])
9695
def test_cache_spans_disabled_middleware(
9796
sentry_init,
@@ -134,7 +133,6 @@ def test_cache_spans_disabled_middleware(
134133

135134
@pytest.mark.forked
136135
@pytest_mark_django_db_decorator()
137-
@pytest.mark.skipif(DJANGO_VERSION < (1, 9), reason="Requires Django >= 1.9")
138136
@pytest.mark.parametrize("span_streaming", [True, False])
139137
def test_cache_spans_disabled_decorator(
140138
sentry_init,
@@ -177,7 +175,6 @@ def test_cache_spans_disabled_decorator(
177175

178176
@pytest.mark.forked
179177
@pytest_mark_django_db_decorator()
180-
@pytest.mark.skipif(DJANGO_VERSION < (1, 9), reason="Requires Django >= 1.9")
181178
@pytest.mark.parametrize("span_streaming", [True, False])
182179
def test_cache_spans_disabled_templatetag(
183180
sentry_init,
@@ -220,7 +217,6 @@ def test_cache_spans_disabled_templatetag(
220217

221218
@pytest.mark.forked
222219
@pytest_mark_django_db_decorator()
223-
@pytest.mark.skipif(DJANGO_VERSION < (1, 9), reason="Requires Django >= 1.9")
224220
@pytest.mark.parametrize("span_streaming", [True, False])
225221
def test_cache_spans_middleware(
226222
sentry_init,
@@ -342,7 +338,6 @@ def test_cache_spans_middleware(
342338

343339
@pytest.mark.forked
344340
@pytest_mark_django_db_decorator()
345-
@pytest.mark.skipif(DJANGO_VERSION < (1, 9), reason="Requires Django >= 1.9")
346341
@pytest.mark.parametrize("span_streaming", [True, False])
347342
def test_cache_spans_decorator(
348343
sentry_init,
@@ -442,7 +437,6 @@ def test_cache_spans_decorator(
442437

443438
@pytest.mark.forked
444439
@pytest_mark_django_db_decorator()
445-
@pytest.mark.skipif(DJANGO_VERSION < (1, 9), reason="Requires Django >= 1.9")
446440
@pytest.mark.parametrize("span_streaming", [True, False])
447441
def test_cache_spans_templatetag(
448442
sentry_init,
@@ -1097,7 +1091,6 @@ def test_cache_spans_set_many(
10971091

10981092
@pytest.mark.forked
10991093
@pytest_mark_django_db_decorator()
1100-
@pytest.mark.skipif(DJANGO_VERSION <= (1, 11), reason="Requires Django > 1.11")
11011094
@pytest.mark.parametrize("span_streaming", [True, False])
11021095
def test_span_origin_cache(
11031096
sentry_init,

tests/integrations/django/test_transactions.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,20 @@ def test_resolver_re_path_multiple_groups():
6868
assert result == "/api/{project_id}/product/{pid}/"
6969

7070

71-
@pytest.mark.skipif(
72-
django.VERSION < (2, 0),
73-
reason="Django>=2.0 required for <converter:parameter> patterns",
74-
)
7571
def test_resolver_path_group():
7672
url_conf = (path("api/v2/<int:project_id>/store/", lambda x: ""),)
7773
resolver = RavenResolver()
7874
result = resolver.resolve("/api/v2/1234/store/", url_conf)
7975
assert result == "/api/v2/{project_id}/store/"
8076

8177

82-
@pytest.mark.skipif(
83-
django.VERSION < (2, 0),
84-
reason="Django>=2.0 required for <converter:parameter> patterns",
85-
)
8678
def test_resolver_path_multiple_groups():
8779
url_conf = (path("api/v2/<str:project_id>/product/<int:pid>", lambda x: ""),)
8880
resolver = RavenResolver()
8981
result = resolver.resolve("/api/v2/myproject/product/5689", url_conf)
9082
assert result == "/api/v2/{project_id}/product/{pid}"
9183

9284

93-
@pytest.mark.skipif(
94-
django.VERSION < (2, 0),
95-
reason="Django>=2.0 required for <converter:parameter> patterns",
96-
)
9785
@pytest.mark.skipif(
9886
django.VERSION > (5, 1),
9987
reason="get_converter removed in 5.1",
@@ -130,21 +118,13 @@ class CustomPathConverter(PathConverter):
130118
assert result == "/api/v3/{my_path}"
131119

132120

133-
@pytest.mark.skipif(
134-
django.VERSION < (2, 0),
135-
reason="Django>=2.0 required for <converter:parameter> patterns",
136-
)
137121
def test_resolver_path_no_converter():
138122
url_conf = (path("api/v4/<project_id>", lambda x: ""),)
139123
resolver = RavenResolver()
140124
result = resolver.resolve("/api/v4/myproject", url_conf)
141125
assert result == "/api/v4/{project_id}"
142126

143127

144-
@pytest.mark.skipif(
145-
django.VERSION < (2, 0),
146-
reason="Django>=2.0 required for path patterns",
147-
)
148128
def test_resolver_path_with_i18n():
149129
url_conf = (path(pgettext_lazy("url", "pgettext"), lambda x: ""),)
150130
resolver = RavenResolver()

tests/integrations/falcon/test_falcon.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import sentry_sdk
88
from sentry_sdk.integrations.falcon import FalconIntegration
99
from sentry_sdk.integrations.logging import LoggingIntegration
10-
from sentry_sdk.utils import parse_version
1110

1211
try:
1312
import falcon.asgi
@@ -17,9 +16,6 @@
1716
import falcon.inspect # We only need this module for the ASGI test
1817

1918

20-
FALCON_VERSION = parse_version(falcon.__version__)
21-
22-
2319
@pytest.fixture
2420
def make_app(sentry_init):
2521
def inner():
@@ -647,9 +643,6 @@ def generator():
647643
assert not sentry_sdk.get_isolation_scope()._tags["request_data"]
648644

649645

650-
@pytest.mark.skipif(
651-
not hasattr(falcon, "asgi"), reason="This Falcon version lacks ASGI support."
652-
)
653646
@pytest.mark.parametrize("span_streaming", [True, False])
654647
def test_falcon_not_breaking_asgi(sentry_init, span_streaming):
655648
"""
@@ -672,10 +665,6 @@ def test_falcon_not_breaking_asgi(sentry_init, span_streaming):
672665
pytest.fail("Falcon integration causing errors in ASGI apps.")
673666

674667

675-
@pytest.mark.skipif(
676-
(FALCON_VERSION or ()) < (3,),
677-
reason="The Sentry Falcon integration only supports custom error handlers on Falcon 3+",
678-
)
679668
@pytest.mark.parametrize("span_streaming", [True, False])
680669
def test_falcon_custom_error_handler(
681670
sentry_init,

tests/integrations/pyramid/test_pyramid.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import pyramid.testing
66
import pytest
7-
from packaging.version import Version
87
from pyramid.authorization import ACLAuthorizationPolicy
98
from pyramid.response import Response
109
from werkzeug.test import Client
@@ -17,19 +16,6 @@
1716
from tests.conftest import unpack_werkzeug_response
1817
from tests.integrations.utils import DATA_COLLECTION_USER_INFO_CASES
1918

20-
try:
21-
from importlib.metadata import version
22-
23-
PYRAMID_VERSION = Version(version("pyramid")).release
24-
25-
except ImportError:
26-
# < py3.8
27-
import pkg_resources
28-
29-
PYRAMID_VERSION = tuple(
30-
map(int, pkg_resources.get_distribution("pyramid").version.split("."))
31-
)
32-
3319

3420
def hi(request):
3521
capture_message("hi")
@@ -348,10 +334,6 @@ def errorhandler(exc, request):
348334
assert not errors
349335

350336

351-
@pytest.mark.skipif(
352-
PYRAMID_VERSION < (1, 9),
353-
reason="We don't have the right hooks in older Pyramid versions",
354-
)
355337
def test_errorhandler_500(
356338
sentry_init, pyramid_config, capture_exceptions, route, get_client
357339
):

tests/integrations/sanic/test_sanic.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
from typing import Any, Optional
3636

3737
SANIC_VERSION = tuple(map(int, SANIC_VERSION_RAW.split(".")))
38-
PERFORMANCE_SUPPORTED = SANIC_VERSION >= (21, 9)
3938

4039

4140
@pytest.fixture
@@ -371,9 +370,6 @@ def __init__(
371370
self.streaming_compatible = streaming_compatible
372371

373372

374-
@pytest.mark.skipif(
375-
not PERFORMANCE_SUPPORTED, reason="Performance not supported on this Sanic version"
376-
)
377373
@pytest.mark.parametrize("send_pii", [True, False])
378374
@pytest.mark.parametrize("span_streaming", [True, False])
379375
@pytest.mark.parametrize(
@@ -533,9 +529,6 @@ def test_transactions(
533529
)
534530

535531

536-
@pytest.mark.skipif(
537-
not PERFORMANCE_SUPPORTED, reason="Performance not supported on this Sanic version"
538-
)
539532
@pytest.mark.parametrize("span_streaming", [True, False])
540533
def test_span_origin(sentry_init, app, capture_events, capture_items, span_streaming):
541534
sentry_init(
@@ -567,9 +560,6 @@ def test_span_origin(sentry_init, app, capture_events, capture_items, span_strea
567560
assert event["contexts"]["trace"]["origin"] == "auto.http.sanic"
568561

569562

570-
@pytest.mark.skipif(
571-
not PERFORMANCE_SUPPORTED, reason="Performance not supported on this Sanic version"
572-
)
573563
@pytest.mark.parametrize("init_kwargs, expect_ip", DATA_COLLECTION_USER_INFO_CASES)
574564
def test_user_ip_address_on_all_spans(
575565
sentry_init, app, capture_items, init_kwargs, expect_ip
@@ -611,9 +601,6 @@ def child_span_handler(request):
611601
assert "user.ip_address" not in child_span["attributes"]
612602

613603

614-
@pytest.mark.skipif(
615-
not PERFORMANCE_SUPPORTED, reason="Performance not supported on this Sanic version"
616-
)
617604
@pytest.mark.parametrize("init_kwargs, expect_ip", DATA_COLLECTION_USER_INFO_CASES)
618605
def test_client_address_span_attribute_data_collection(
619606
sentry_init, app, capture_items, init_kwargs, expect_ip
@@ -721,9 +708,6 @@ def test_client_address_span_attribute_data_collection(
721708
]
722709

723710

724-
@pytest.mark.skipif(
725-
not PERFORMANCE_SUPPORTED, reason="Performance not supported on this Sanic version"
726-
)
727711
@pytest.mark.parametrize(
728712
"init_kwargs, expected_query", _QUERY_PARAM_DATA_COLLECTION_CASES
729713
)

tests/integrations/threading/test_threading.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import gc
21
import sys
32
from concurrent import futures
43
from textwrap import dedent
@@ -38,27 +37,6 @@ def crash():
3837
assert not events
3938

4039

41-
@pytest.mark.skip(reason="Temporarily disable to release SDK 2.0a1.")
42-
def test_circular_references(sentry_init, request):
43-
sentry_init(default_integrations=False, integrations=[ThreadingIntegration()])
44-
45-
gc.collect()
46-
gc.disable()
47-
request.addfinalizer(gc.enable)
48-
49-
class MyThread(Thread):
50-
def run(self):
51-
pass
52-
53-
t = MyThread()
54-
t.start()
55-
t.join()
56-
del t
57-
58-
unreachable_objects = gc.collect()
59-
assert unreachable_objects == 0
60-
61-
6240
@pytest.mark.filterwarnings("ignore:.*:pytest.PytestUnhandledThreadExceptionWarning")
6341
def test_double_patching(sentry_init, capture_events):
6442
sentry_init(default_integrations=False, integrations=[ThreadingIntegration()])

tests/integrations/trytond_wsgi/test_trytond.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import unittest.mock
33

44
import pytest
5-
import trytond
65
from trytond.exceptions import LoginException
76
from trytond.exceptions import TrytonException as TrytondBaseException
87
from trytond.exceptions import UserError as TrytondUserError
@@ -75,9 +74,6 @@ def _(request):
7574
assert not exceptions
7675

7776

78-
@pytest.mark.skipif(
79-
trytond.__version__.split(".") < ["5", "4"], reason="At least Trytond-5.4 required"
80-
)
8177
def test_rpc_error_page(sentry_init, app, get_client):
8278
"""Test that, after initializing the Trytond-SentrySDK integration
8379
a custom error handler can be registered to the Trytond WSGI app so as to

0 commit comments

Comments
 (0)