Skip to content

Commit 8aa9599

Browse files
committed
Remove PY2
1 parent fc38343 commit 8aa9599

File tree

4 files changed

+7
-16
lines changed

4 files changed

+7
-16
lines changed

sentry_sdk/tracing_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def add_query_source(hub, span):
251251
except Exception:
252252
filepath = None
253253
if filepath is not None:
254-
if namespace is not None and not PY2:
254+
if namespace is not None:
255255
in_app_path = filename_for_module(namespace, filepath)
256256
elif project_root is not None and filepath.startswith(project_root):
257257
in_app_path = filepath.replace(project_root, "").lstrip(os.sep)

tests/integrations/asyncpg/test_asyncpg.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
PG_HOST = os.getenv("SENTRY_PYTHON_TEST_POSTGRES_HOST", "localhost")
1919
PG_PORT = 5432
2020

21-
22-
from sentry_sdk._compat import PY2
2321
import datetime
2422
from contextlib import contextmanager
2523
from unittest import mock
@@ -627,9 +625,8 @@ async def test_query_source_with_module_in_search_path(sentry_init, capture_even
627625

628626
assert type(data.get(SPANDATA.CODE_LINENO)) == int
629627
assert data.get(SPANDATA.CODE_LINENO) > 0
630-
if not PY2:
631-
assert data.get(SPANDATA.CODE_NAMESPACE) == "asyncpg_helpers.helpers"
632-
assert data.get(SPANDATA.CODE_FILEPATH) == "asyncpg_helpers/helpers.py"
628+
assert data.get(SPANDATA.CODE_NAMESPACE) == "asyncpg_helpers.helpers"
629+
assert data.get(SPANDATA.CODE_FILEPATH) == "asyncpg_helpers/helpers.py"
633630

634631
is_relative_path = data.get(SPANDATA.CODE_FILEPATH)[0] != os.sep
635632
assert is_relative_path

tests/integrations/django/test_db_query_data.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from datetime import datetime
55
from unittest import mock
66

7-
from sentry_sdk._compat import PY2
87
from django import VERSION as DJANGO_VERSION
98
from django.db import connections
109

@@ -205,10 +204,8 @@ def test_query_source_with_module_in_search_path(sentry_init, client, capture_ev
205204

206205
assert type(data.get(SPANDATA.CODE_LINENO)) == int
207206
assert data.get(SPANDATA.CODE_LINENO) > 0
208-
209-
if not PY2:
210-
assert data.get(SPANDATA.CODE_NAMESPACE) == "django_helpers.views"
211-
assert data.get(SPANDATA.CODE_FILEPATH) == "django_helpers/views.py"
207+
assert data.get(SPANDATA.CODE_NAMESPACE) == "django_helpers.views"
208+
assert data.get(SPANDATA.CODE_FILEPATH) == "django_helpers/views.py"
212209

213210
is_relative_path = data.get(SPANDATA.CODE_FILEPATH)[0] != os.sep
214211
assert is_relative_path

tests/integrations/sqlalchemy/test_sqlalchemy.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,8 @@ class Person(Base):
490490

491491
assert type(data.get(SPANDATA.CODE_LINENO)) == int
492492
assert data.get(SPANDATA.CODE_LINENO) > 0
493-
if not PY2:
494-
assert data.get(SPANDATA.CODE_NAMESPACE) == "sqlalchemy_helpers.helpers"
495-
assert (
496-
data.get(SPANDATA.CODE_FILEPATH) == "sqlalchemy_helpers/helpers.py"
497-
)
493+
assert data.get(SPANDATA.CODE_NAMESPACE) == "sqlalchemy_helpers.helpers"
494+
assert data.get(SPANDATA.CODE_FILEPATH) == "sqlalchemy_helpers/helpers.py"
498495

499496
is_relative_path = data.get(SPANDATA.CODE_FILEPATH)[0] != os.sep
500497
assert is_relative_path

0 commit comments

Comments
 (0)