From 65472a739883f2b3eadf79d689ac02626538c49b Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Fri, 15 Nov 2024 13:00:20 +0100 Subject: [PATCH] fix some lint things --- sentry_sdk/_init_implementation.py | 2 -- sentry_sdk/integrations/aiohttp.py | 2 +- tests/test_api.py | 1 - tests/test_utils.py | 49 ------------------------------ 4 files changed, 1 insertion(+), 53 deletions(-) diff --git a/sentry_sdk/_init_implementation.py b/sentry_sdk/_init_implementation.py index 5be94e1e60..dc235af243 100644 --- a/sentry_sdk/_init_implementation.py +++ b/sentry_sdk/_init_implementation.py @@ -1,5 +1,3 @@ -import warnings - from typing import TYPE_CHECKING import sentry_sdk diff --git a/sentry_sdk/integrations/aiohttp.py b/sentry_sdk/integrations/aiohttp.py index 9257eca49a..ccc4593606 100644 --- a/sentry_sdk/integrations/aiohttp.py +++ b/sentry_sdk/integrations/aiohttp.py @@ -390,7 +390,7 @@ def _prepopulate_attributes(request): attributes["server.address"] = request.host try: - url = f"{request.scheme}://{request.host}{request.path}" + url = f"{request.scheme}://{request.host}{request.path}" # noqa: E231 if request.query_string: attributes["url.full"] = f"{url}?{request.query_string}" except Exception: diff --git a/tests/test_api.py b/tests/test_api.py index 0c79c035b1..46fc24fd24 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1,7 +1,6 @@ import pytest from unittest import mock -import sentry_sdk from sentry_sdk import ( capture_exception, continue_trace, diff --git a/tests/test_utils.py b/tests/test_utils.py index 40894a8e52..5011662f05 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -60,55 +60,6 @@ def _normalize_distribution_name(name): return re.sub(r"[-_.]+", "-", name).lower() -@pytest.mark.parametrize( - ("input_str", "expected_output"), - ( - ( - "2021-01-01T00:00:00.000000Z", - datetime(2021, 1, 1, tzinfo=timezone.utc), - ), # UTC time - ( - "2021-01-01T00:00:00.000000", - datetime(2021, 1, 1).astimezone(timezone.utc), - ), # No TZ -- assume local but convert to UTC - ( - "2021-01-01T00:00:00Z", - datetime(2021, 1, 1, tzinfo=timezone.utc), - ), # UTC - No milliseconds - ( - "2021-01-01T00:00:00.000000+00:00", - datetime(2021, 1, 1, tzinfo=timezone.utc), - ), - ( - "2021-01-01T00:00:00.000000-00:00", - datetime(2021, 1, 1, tzinfo=timezone.utc), - ), - ( - "2021-01-01T00:00:00.000000+0000", - datetime(2021, 1, 1, tzinfo=timezone.utc), - ), - ( - "2021-01-01T00:00:00.000000-0000", - datetime(2021, 1, 1, tzinfo=timezone.utc), - ), - ( - "2020-12-31T00:00:00.000000+02:00", - datetime(2020, 12, 31, tzinfo=timezone(timedelta(hours=2))), - ), # UTC+2 time - ( - "2020-12-31T00:00:00.000000-0200", - datetime(2020, 12, 31, tzinfo=timezone(timedelta(hours=-2))), - ), # UTC-2 time - ( - "2020-12-31T00:00:00-0200", - datetime(2020, 12, 31, tzinfo=timezone(timedelta(hours=-2))), - ), # UTC-2 time - no milliseconds - ), -) -def test_datetime_from_isoformat(input_str, expected_output): - assert datetime_from_isoformat(input_str) == expected_output, input_str - - @pytest.mark.parametrize( "env_var_value,strict,expected", [