From 2407c574fd39c751d9a11189b8b4c52ed924b5ba Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Wed, 30 Mar 2022 13:23:11 +0200 Subject: [PATCH 1/7] Updated black --- linter-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linter-requirements.txt b/linter-requirements.txt index 8c7dd7d6e5..744904fbc2 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,4 +1,4 @@ -black==21.7b0 +black==22.3.0 flake8==3.9.2 flake8-import-order==0.18.1 mypy==0.782 From dde842bcec70230fc8fca2df100b1837b357926f Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Wed, 30 Mar 2022 13:26:32 +0200 Subject: [PATCH 2/7] Reformatted code with new black. --- sentry_sdk/client.py | 1 - sentry_sdk/hub.py | 1 - sentry_sdk/integrations/_wsgi_common.py | 4 +- sentry_sdk/integrations/django/__init__.py | 3 +- sentry_sdk/integrations/pyramid.py | 1 - sentry_sdk/integrations/wsgi.py | 1 - sentry_sdk/serializer.py | 6 +- sentry_sdk/tracing.py | 38 ++++++----- sentry_sdk/utils.py | 10 ++- tests/conftest.py | 1 - tests/integrations/bottle/test_bottle.py | 2 +- tests/integrations/django/myapp/views.py | 1 - tests/integrations/django/test_basic.py | 8 +-- tests/test_client.py | 4 +- tests/test_serializer.py | 2 +- tests/utils/test_general.py | 76 +++++++++------------- 16 files changed, 72 insertions(+), 87 deletions(-) diff --git a/sentry_sdk/client.py b/sentry_sdk/client.py index 1720993c1a..efc8799c00 100644 --- a/sentry_sdk/client.py +++ b/sentry_sdk/client.py @@ -451,7 +451,6 @@ class get_options(ClientConstructor, Dict[str, Any]): # noqa: N801 class Client(ClientConstructor, _Client): pass - else: # Alias `get_options` for actual usage. Go through the lambda indirection # to throw PyCharm off of the weakly typed signature (it would otherwise diff --git a/sentry_sdk/hub.py b/sentry_sdk/hub.py index addca57417..22f3ff42fd 100644 --- a/sentry_sdk/hub.py +++ b/sentry_sdk/hub.py @@ -120,7 +120,6 @@ def _init(*args, **kwargs): class init(ClientConstructor, ContextManager[Any]): # noqa: N801 pass - else: # Alias `init` for actual usage. Go through the lambda indirection to throw # PyCharm off of the weakly typed signature (it would otherwise discover diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index f4cc7672e9..4f253acc35 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -39,8 +39,8 @@ def request_body_within_bounds(client, content_length): bodies = client.options["request_bodies"] return not ( bodies == "never" - or (bodies == "small" and content_length > 10 ** 3) - or (bodies == "medium" and content_length > 10 ** 4) + or (bodies == "small" and content_length > 10**3) + or (bodies == "medium" and content_length > 10**4) ) diff --git a/sentry_sdk/integrations/django/__init__.py b/sentry_sdk/integrations/django/__init__.py index db90918529..7eb91887df 100644 --- a/sentry_sdk/integrations/django/__init__.py +++ b/sentry_sdk/integrations/django/__init__.py @@ -69,7 +69,6 @@ def is_authenticated(request_user): # type: (Any) -> bool return request_user.is_authenticated() - else: def is_authenticated(request_user): @@ -202,7 +201,7 @@ def _django_queryset_repr(value, hint): # querysets. This might be surprising to the user but it's likely # less annoying. - return u"<%s from %s at 0x%x>" % ( + return "<%s from %s at 0x%x>" % ( value.__class__.__name__, value.__module__, id(value), diff --git a/sentry_sdk/integrations/pyramid.py b/sentry_sdk/integrations/pyramid.py index 980d56bb6f..07142254d2 100644 --- a/sentry_sdk/integrations/pyramid.py +++ b/sentry_sdk/integrations/pyramid.py @@ -40,7 +40,6 @@ def authenticated_userid(request): # type: (Request) -> Optional[Any] return request.authenticated_userid - else: # bw-compat for pyramid < 1.5 from pyramid.security import authenticated_userid # type: ignore diff --git a/sentry_sdk/integrations/wsgi.py b/sentry_sdk/integrations/wsgi.py index 4f274fa00c..803406fb6d 100644 --- a/sentry_sdk/integrations/wsgi.py +++ b/sentry_sdk/integrations/wsgi.py @@ -46,7 +46,6 @@ def wsgi_decoding_dance(s, charset="utf-8", errors="replace"): # type: (str, str, str) -> str return s.decode(charset, errors) - else: def wsgi_decoding_dance(s, charset="utf-8", errors="replace"): diff --git a/sentry_sdk/serializer.py b/sentry_sdk/serializer.py index 134528cd9a..e657f6b2b8 100644 --- a/sentry_sdk/serializer.py +++ b/sentry_sdk/serializer.py @@ -66,11 +66,11 @@ # Can be overwritten if wanting to send more bytes, e.g. with a custom server. # When changing this, keep in mind that events may be a little bit larger than # this value due to attached metadata, so keep the number conservative. -MAX_EVENT_BYTES = 10 ** 6 +MAX_EVENT_BYTES = 10**6 MAX_DATABAG_DEPTH = 5 MAX_DATABAG_BREADTH = 10 -CYCLE_MARKER = u"" +CYCLE_MARKER = "" global_repr_processors = [] # type: List[ReprProcessor] @@ -228,7 +228,7 @@ def _serialize_node( capture_internal_exception(sys.exc_info()) if is_databag: - return u"" + return "" return None finally: diff --git a/sentry_sdk/tracing.py b/sentry_sdk/tracing.py index 48050350fb..1b5b65e1af 100644 --- a/sentry_sdk/tracing.py +++ b/sentry_sdk/tracing.py @@ -132,14 +132,17 @@ def init_span_recorder(self, maxlen): def __repr__(self): # type: () -> str - return "<%s(op=%r, description:%r, trace_id=%r, span_id=%r, parent_span_id=%r, sampled=%r)>" % ( - self.__class__.__name__, - self.op, - self.description, - self.trace_id, - self.span_id, - self.parent_span_id, - self.sampled, + return ( + "<%s(op=%r, description:%r, trace_id=%r, span_id=%r, parent_span_id=%r, sampled=%r)>" + % ( + self.__class__.__name__, + self.op, + self.description, + self.trace_id, + self.span_id, + self.parent_span_id, + self.sampled, + ) ) def __enter__(self): @@ -515,14 +518,17 @@ def __init__( def __repr__(self): # type: () -> str - return "<%s(name=%r, op=%r, trace_id=%r, span_id=%r, parent_span_id=%r, sampled=%r)>" % ( - self.__class__.__name__, - self.name, - self.op, - self.trace_id, - self.span_id, - self.parent_span_id, - self.sampled, + return ( + "<%s(name=%r, op=%r, trace_id=%r, span_id=%r, parent_span_id=%r, sampled=%r)>" + % ( + self.__class__.__name__, + self.name, + self.op, + self.trace_id, + self.span_id, + self.parent_span_id, + self.sampled, + ) ) @property diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index cc519a58a7..e22f6ae065 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -161,7 +161,7 @@ def __init__(self, value): return parts = urlparse.urlsplit(text_type(value)) - if parts.scheme not in (u"http", u"https"): + if parts.scheme not in ("http", "https"): raise BadDsn("Unsupported scheme %r" % parts.scheme) self.scheme = parts.scheme @@ -280,7 +280,7 @@ def to_header(self, timestamp=None): rv.append(("sentry_client", self.client)) if self.secret_key is not None: rv.append(("sentry_secret", self.secret_key)) - return u"Sentry " + u", ".join("%s=%s" % (key, value) for key, value in rv) + return "Sentry " + ", ".join("%s=%s" % (key, value) for key, value in rv) class AnnotatedValue(object): @@ -440,8 +440,7 @@ def safe_repr(value): return rv except Exception: # If e.g. the call to `repr` already fails - return u"" - + return "" else: @@ -606,7 +605,6 @@ def walk_exception_chain(exc_info): exc_value = cause tb = getattr(cause, "__traceback__", None) - else: def walk_exception_chain(exc_info): @@ -772,7 +770,7 @@ def strip_string(value, max_length=None): if length > max_length: return AnnotatedValue( - value=value[: max_length - 3] + u"...", + value=value[: max_length - 3] + "...", metadata={ "len": length, "rem": [["!limit", "x", max_length - 3, max_length]], diff --git a/tests/conftest.py b/tests/conftest.py index 692a274d71..61f25d98ee 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -39,7 +39,6 @@ def benchmark(): return lambda x: x() - else: del pytest_benchmark diff --git a/tests/integrations/bottle/test_bottle.py b/tests/integrations/bottle/test_bottle.py index 16aacb55c5..ec133e4d75 100644 --- a/tests/integrations/bottle/test_bottle.py +++ b/tests/integrations/bottle/test_bottle.py @@ -196,7 +196,7 @@ def index(): assert len(event["request"]["data"]["foo"]) == 512 -@pytest.mark.parametrize("input_char", [u"a", b"a"]) +@pytest.mark.parametrize("input_char", ["a", b"a"]) def test_too_large_raw_request( sentry_init, input_char, capture_events, app, get_client ): diff --git a/tests/integrations/django/myapp/views.py b/tests/integrations/django/myapp/views.py index cac881552c..02c67ca150 100644 --- a/tests/integrations/django/myapp/views.py +++ b/tests/integrations/django/myapp/views.py @@ -29,7 +29,6 @@ def rest_hello(request): def rest_permission_denied_exc(request): raise PermissionDenied("bye") - except ImportError: pass diff --git a/tests/integrations/django/test_basic.py b/tests/integrations/django/test_basic.py index cc77c9a76a..6106131375 100644 --- a/tests/integrations/django/test_basic.py +++ b/tests/integrations/django/test_basic.py @@ -576,15 +576,15 @@ def test_template_exception( if with_executing_integration: assert filenames[-3:] == [ - (u"Parser.parse", u"django.template.base"), + ("Parser.parse", "django.template.base"), (None, None), - (u"Parser.invalid_block_tag", u"django.template.base"), + ("Parser.invalid_block_tag", "django.template.base"), ] else: assert filenames[-3:] == [ - (u"parse", u"django.template.base"), + ("parse", "django.template.base"), (None, None), - (u"invalid_block_tag", u"django.template.base"), + ("invalid_block_tag", "django.template.base"), ] diff --git a/tests/test_client.py b/tests/test_client.py index 9137f4115a..25d9d2e75a 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -496,7 +496,7 @@ def test_scope_initialized_before_client(sentry_init, capture_events): def test_weird_chars(sentry_init, capture_events): sentry_init() events = capture_events() - capture_message(u"föö".encode("latin1")) + capture_message("föö".encode("latin1")) (event,) = events assert json.loads(json.dumps(event)) == event @@ -812,7 +812,7 @@ def __repr__(self): "dsn", [ "http://894b7d594095440f8dfea9b300e6f572@localhost:8000/2", - u"http://894b7d594095440f8dfea9b300e6f572@localhost:8000/2", + "http://894b7d594095440f8dfea9b300e6f572@localhost:8000/2", ], ) def test_init_string_types(dsn, sentry_init): diff --git a/tests/test_serializer.py b/tests/test_serializer.py index 1cc20c4b4a..6071a03be3 100644 --- a/tests/test_serializer.py +++ b/tests/test_serializer.py @@ -50,7 +50,7 @@ def inner(message, **kwargs): def test_bytes_serialization_decode(message_normalizer): binary = b"abc123\x80\xf0\x9f\x8d\x95" result = message_normalizer(binary, should_repr_strings=False) - assert result == u"abc123\ufffd\U0001f355" + assert result == "abc123\ufffd\U0001f355" @pytest.mark.xfail(sys.version_info < (3,), reason="Known safe_repr bugs in Py2.7") diff --git a/tests/utils/test_general.py b/tests/utils/test_general.py index 03be52ca17..550f9c2fb7 100644 --- a/tests/utils/test_general.py +++ b/tests/utils/test_general.py @@ -31,19 +31,19 @@ def test_safe_repr_never_broken_for_strings(x): r = safe_repr(x) assert isinstance(r, text_type) - assert u"broken repr" not in r + assert "broken repr" not in r def test_safe_repr_regressions(): - assert u"лошадь" in safe_repr(u"лошадь") + assert "лошадь" in safe_repr("лошадь") @pytest.mark.xfail( sys.version_info < (3,), reason="Fixing this in Python 2 would break other behaviors", ) -@pytest.mark.parametrize("prefix", (u"", u"abcd", u"лошадь")) -@pytest.mark.parametrize("character", u"\x00\x07\x1b\n") +@pytest.mark.parametrize("prefix", ("", "abcd", "лошадь")) +@pytest.mark.parametrize("character", "\x00\x07\x1b\n") def test_safe_repr_non_printable(prefix, character): """Check that non-printable characters are escaped""" string = prefix + character @@ -129,47 +129,35 @@ def test_parse_invalid_dsn(dsn): @pytest.mark.parametrize("empty", [None, []]) def test_in_app(empty): - assert ( - handle_in_app_impl( - [{"module": "foo"}, {"module": "bar"}], - in_app_include=["foo"], - in_app_exclude=empty, - ) - == [{"module": "foo", "in_app": True}, {"module": "bar"}] - ) - - assert ( - handle_in_app_impl( - [{"module": "foo"}, {"module": "bar"}], - in_app_include=["foo"], - in_app_exclude=["foo"], - ) - == [{"module": "foo", "in_app": True}, {"module": "bar"}] - ) - - assert ( - handle_in_app_impl( - [{"module": "foo"}, {"module": "bar"}], - in_app_include=empty, - in_app_exclude=["foo"], - ) - == [{"module": "foo", "in_app": False}, {"module": "bar", "in_app": True}] - ) + assert handle_in_app_impl( + [{"module": "foo"}, {"module": "bar"}], + in_app_include=["foo"], + in_app_exclude=empty, + ) == [{"module": "foo", "in_app": True}, {"module": "bar"}] + + assert handle_in_app_impl( + [{"module": "foo"}, {"module": "bar"}], + in_app_include=["foo"], + in_app_exclude=["foo"], + ) == [{"module": "foo", "in_app": True}, {"module": "bar"}] + + assert handle_in_app_impl( + [{"module": "foo"}, {"module": "bar"}], + in_app_include=empty, + in_app_exclude=["foo"], + ) == [{"module": "foo", "in_app": False}, {"module": "bar", "in_app": True}] def test_iter_stacktraces(): - assert ( - set( - iter_event_stacktraces( - { - "threads": {"values": [{"stacktrace": 1}]}, - "stacktrace": 2, - "exception": {"values": [{"stacktrace": 3}]}, - } - ) + assert set( + iter_event_stacktraces( + { + "threads": {"values": [{"stacktrace": 1}]}, + "stacktrace": 2, + "exception": {"values": [{"stacktrace": 3}]}, + } ) - == {1, 2, 3} - ) + ) == {1, 2, 3} @pytest.mark.parametrize( @@ -178,15 +166,15 @@ def test_iter_stacktraces(): # ascii only ("Dogs are great!", "RG9ncyBhcmUgZ3JlYXQh"), # emoji - (u"🐶", "8J+Qtg=="), + ("🐶", "8J+Qtg=="), # non-ascii ( - u"Καλό κορίτσι, Μάιζεϊ!", + "Καλό κορίτσι, Μάιζεϊ!", "zprOsc67z4wgzrrOv8+Bzq/PhM+DzrksIM6czqzOuc62zrXPiiE=", ), # mix of ascii and non-ascii ( - u"Of margir hundar! Ég geri ráð fyrir að ég þurfi stærra rúm.", + "Of margir hundar! Ég geri ráð fyrir að ég þurfi stærra rúm.", "T2YgbWFyZ2lyIGh1bmRhciEgw4lnIGdlcmkgcsOhw7AgZnlyaXIgYcOwIMOpZyDDvnVyZmkgc3TDpnJyYSByw7ptLg==", ), ], From 15a4a5810f5a5c3a335740323c4e0559f20460df Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Wed, 30 Mar 2022 21:54:39 +0200 Subject: [PATCH 3/7] Revert "Reformatted code with new black." This reverts commit dde842bcec70230fc8fca2df100b1837b357926f. --- sentry_sdk/client.py | 1 + sentry_sdk/hub.py | 1 + sentry_sdk/integrations/_wsgi_common.py | 4 +- sentry_sdk/integrations/django/__init__.py | 3 +- sentry_sdk/integrations/pyramid.py | 1 + sentry_sdk/integrations/wsgi.py | 1 + sentry_sdk/serializer.py | 6 +- sentry_sdk/tracing.py | 38 +++++------ sentry_sdk/utils.py | 10 +-- tests/conftest.py | 1 + tests/integrations/bottle/test_bottle.py | 2 +- tests/integrations/django/myapp/views.py | 1 + tests/integrations/django/test_basic.py | 8 +-- tests/test_client.py | 4 +- tests/test_serializer.py | 2 +- tests/utils/test_general.py | 76 +++++++++++++--------- 16 files changed, 87 insertions(+), 72 deletions(-) diff --git a/sentry_sdk/client.py b/sentry_sdk/client.py index efc8799c00..1720993c1a 100644 --- a/sentry_sdk/client.py +++ b/sentry_sdk/client.py @@ -451,6 +451,7 @@ class get_options(ClientConstructor, Dict[str, Any]): # noqa: N801 class Client(ClientConstructor, _Client): pass + else: # Alias `get_options` for actual usage. Go through the lambda indirection # to throw PyCharm off of the weakly typed signature (it would otherwise diff --git a/sentry_sdk/hub.py b/sentry_sdk/hub.py index 22f3ff42fd..addca57417 100644 --- a/sentry_sdk/hub.py +++ b/sentry_sdk/hub.py @@ -120,6 +120,7 @@ def _init(*args, **kwargs): class init(ClientConstructor, ContextManager[Any]): # noqa: N801 pass + else: # Alias `init` for actual usage. Go through the lambda indirection to throw # PyCharm off of the weakly typed signature (it would otherwise discover diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index 4f253acc35..f4cc7672e9 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -39,8 +39,8 @@ def request_body_within_bounds(client, content_length): bodies = client.options["request_bodies"] return not ( bodies == "never" - or (bodies == "small" and content_length > 10**3) - or (bodies == "medium" and content_length > 10**4) + or (bodies == "small" and content_length > 10 ** 3) + or (bodies == "medium" and content_length > 10 ** 4) ) diff --git a/sentry_sdk/integrations/django/__init__.py b/sentry_sdk/integrations/django/__init__.py index 7eb91887df..db90918529 100644 --- a/sentry_sdk/integrations/django/__init__.py +++ b/sentry_sdk/integrations/django/__init__.py @@ -69,6 +69,7 @@ def is_authenticated(request_user): # type: (Any) -> bool return request_user.is_authenticated() + else: def is_authenticated(request_user): @@ -201,7 +202,7 @@ def _django_queryset_repr(value, hint): # querysets. This might be surprising to the user but it's likely # less annoying. - return "<%s from %s at 0x%x>" % ( + return u"<%s from %s at 0x%x>" % ( value.__class__.__name__, value.__module__, id(value), diff --git a/sentry_sdk/integrations/pyramid.py b/sentry_sdk/integrations/pyramid.py index 07142254d2..980d56bb6f 100644 --- a/sentry_sdk/integrations/pyramid.py +++ b/sentry_sdk/integrations/pyramid.py @@ -40,6 +40,7 @@ def authenticated_userid(request): # type: (Request) -> Optional[Any] return request.authenticated_userid + else: # bw-compat for pyramid < 1.5 from pyramid.security import authenticated_userid # type: ignore diff --git a/sentry_sdk/integrations/wsgi.py b/sentry_sdk/integrations/wsgi.py index 803406fb6d..4f274fa00c 100644 --- a/sentry_sdk/integrations/wsgi.py +++ b/sentry_sdk/integrations/wsgi.py @@ -46,6 +46,7 @@ def wsgi_decoding_dance(s, charset="utf-8", errors="replace"): # type: (str, str, str) -> str return s.decode(charset, errors) + else: def wsgi_decoding_dance(s, charset="utf-8", errors="replace"): diff --git a/sentry_sdk/serializer.py b/sentry_sdk/serializer.py index e657f6b2b8..134528cd9a 100644 --- a/sentry_sdk/serializer.py +++ b/sentry_sdk/serializer.py @@ -66,11 +66,11 @@ # Can be overwritten if wanting to send more bytes, e.g. with a custom server. # When changing this, keep in mind that events may be a little bit larger than # this value due to attached metadata, so keep the number conservative. -MAX_EVENT_BYTES = 10**6 +MAX_EVENT_BYTES = 10 ** 6 MAX_DATABAG_DEPTH = 5 MAX_DATABAG_BREADTH = 10 -CYCLE_MARKER = "" +CYCLE_MARKER = u"" global_repr_processors = [] # type: List[ReprProcessor] @@ -228,7 +228,7 @@ def _serialize_node( capture_internal_exception(sys.exc_info()) if is_databag: - return "" + return u"" return None finally: diff --git a/sentry_sdk/tracing.py b/sentry_sdk/tracing.py index 1b5b65e1af..48050350fb 100644 --- a/sentry_sdk/tracing.py +++ b/sentry_sdk/tracing.py @@ -132,17 +132,14 @@ def init_span_recorder(self, maxlen): def __repr__(self): # type: () -> str - return ( - "<%s(op=%r, description:%r, trace_id=%r, span_id=%r, parent_span_id=%r, sampled=%r)>" - % ( - self.__class__.__name__, - self.op, - self.description, - self.trace_id, - self.span_id, - self.parent_span_id, - self.sampled, - ) + return "<%s(op=%r, description:%r, trace_id=%r, span_id=%r, parent_span_id=%r, sampled=%r)>" % ( + self.__class__.__name__, + self.op, + self.description, + self.trace_id, + self.span_id, + self.parent_span_id, + self.sampled, ) def __enter__(self): @@ -518,17 +515,14 @@ def __init__( def __repr__(self): # type: () -> str - return ( - "<%s(name=%r, op=%r, trace_id=%r, span_id=%r, parent_span_id=%r, sampled=%r)>" - % ( - self.__class__.__name__, - self.name, - self.op, - self.trace_id, - self.span_id, - self.parent_span_id, - self.sampled, - ) + return "<%s(name=%r, op=%r, trace_id=%r, span_id=%r, parent_span_id=%r, sampled=%r)>" % ( + self.__class__.__name__, + self.name, + self.op, + self.trace_id, + self.span_id, + self.parent_span_id, + self.sampled, ) @property diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index e22f6ae065..cc519a58a7 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -161,7 +161,7 @@ def __init__(self, value): return parts = urlparse.urlsplit(text_type(value)) - if parts.scheme not in ("http", "https"): + if parts.scheme not in (u"http", u"https"): raise BadDsn("Unsupported scheme %r" % parts.scheme) self.scheme = parts.scheme @@ -280,7 +280,7 @@ def to_header(self, timestamp=None): rv.append(("sentry_client", self.client)) if self.secret_key is not None: rv.append(("sentry_secret", self.secret_key)) - return "Sentry " + ", ".join("%s=%s" % (key, value) for key, value in rv) + return u"Sentry " + u", ".join("%s=%s" % (key, value) for key, value in rv) class AnnotatedValue(object): @@ -440,7 +440,8 @@ def safe_repr(value): return rv except Exception: # If e.g. the call to `repr` already fails - return "" + return u"" + else: @@ -605,6 +606,7 @@ def walk_exception_chain(exc_info): exc_value = cause tb = getattr(cause, "__traceback__", None) + else: def walk_exception_chain(exc_info): @@ -770,7 +772,7 @@ def strip_string(value, max_length=None): if length > max_length: return AnnotatedValue( - value=value[: max_length - 3] + "...", + value=value[: max_length - 3] + u"...", metadata={ "len": length, "rem": [["!limit", "x", max_length - 3, max_length]], diff --git a/tests/conftest.py b/tests/conftest.py index 61f25d98ee..692a274d71 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -39,6 +39,7 @@ def benchmark(): return lambda x: x() + else: del pytest_benchmark diff --git a/tests/integrations/bottle/test_bottle.py b/tests/integrations/bottle/test_bottle.py index ec133e4d75..16aacb55c5 100644 --- a/tests/integrations/bottle/test_bottle.py +++ b/tests/integrations/bottle/test_bottle.py @@ -196,7 +196,7 @@ def index(): assert len(event["request"]["data"]["foo"]) == 512 -@pytest.mark.parametrize("input_char", ["a", b"a"]) +@pytest.mark.parametrize("input_char", [u"a", b"a"]) def test_too_large_raw_request( sentry_init, input_char, capture_events, app, get_client ): diff --git a/tests/integrations/django/myapp/views.py b/tests/integrations/django/myapp/views.py index 02c67ca150..cac881552c 100644 --- a/tests/integrations/django/myapp/views.py +++ b/tests/integrations/django/myapp/views.py @@ -29,6 +29,7 @@ def rest_hello(request): def rest_permission_denied_exc(request): raise PermissionDenied("bye") + except ImportError: pass diff --git a/tests/integrations/django/test_basic.py b/tests/integrations/django/test_basic.py index 6106131375..cc77c9a76a 100644 --- a/tests/integrations/django/test_basic.py +++ b/tests/integrations/django/test_basic.py @@ -576,15 +576,15 @@ def test_template_exception( if with_executing_integration: assert filenames[-3:] == [ - ("Parser.parse", "django.template.base"), + (u"Parser.parse", u"django.template.base"), (None, None), - ("Parser.invalid_block_tag", "django.template.base"), + (u"Parser.invalid_block_tag", u"django.template.base"), ] else: assert filenames[-3:] == [ - ("parse", "django.template.base"), + (u"parse", u"django.template.base"), (None, None), - ("invalid_block_tag", "django.template.base"), + (u"invalid_block_tag", u"django.template.base"), ] diff --git a/tests/test_client.py b/tests/test_client.py index 25d9d2e75a..9137f4115a 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -496,7 +496,7 @@ def test_scope_initialized_before_client(sentry_init, capture_events): def test_weird_chars(sentry_init, capture_events): sentry_init() events = capture_events() - capture_message("föö".encode("latin1")) + capture_message(u"föö".encode("latin1")) (event,) = events assert json.loads(json.dumps(event)) == event @@ -812,7 +812,7 @@ def __repr__(self): "dsn", [ "http://894b7d594095440f8dfea9b300e6f572@localhost:8000/2", - "http://894b7d594095440f8dfea9b300e6f572@localhost:8000/2", + u"http://894b7d594095440f8dfea9b300e6f572@localhost:8000/2", ], ) def test_init_string_types(dsn, sentry_init): diff --git a/tests/test_serializer.py b/tests/test_serializer.py index 6071a03be3..1cc20c4b4a 100644 --- a/tests/test_serializer.py +++ b/tests/test_serializer.py @@ -50,7 +50,7 @@ def inner(message, **kwargs): def test_bytes_serialization_decode(message_normalizer): binary = b"abc123\x80\xf0\x9f\x8d\x95" result = message_normalizer(binary, should_repr_strings=False) - assert result == "abc123\ufffd\U0001f355" + assert result == u"abc123\ufffd\U0001f355" @pytest.mark.xfail(sys.version_info < (3,), reason="Known safe_repr bugs in Py2.7") diff --git a/tests/utils/test_general.py b/tests/utils/test_general.py index 550f9c2fb7..03be52ca17 100644 --- a/tests/utils/test_general.py +++ b/tests/utils/test_general.py @@ -31,19 +31,19 @@ def test_safe_repr_never_broken_for_strings(x): r = safe_repr(x) assert isinstance(r, text_type) - assert "broken repr" not in r + assert u"broken repr" not in r def test_safe_repr_regressions(): - assert "лошадь" in safe_repr("лошадь") + assert u"лошадь" in safe_repr(u"лошадь") @pytest.mark.xfail( sys.version_info < (3,), reason="Fixing this in Python 2 would break other behaviors", ) -@pytest.mark.parametrize("prefix", ("", "abcd", "лошадь")) -@pytest.mark.parametrize("character", "\x00\x07\x1b\n") +@pytest.mark.parametrize("prefix", (u"", u"abcd", u"лошадь")) +@pytest.mark.parametrize("character", u"\x00\x07\x1b\n") def test_safe_repr_non_printable(prefix, character): """Check that non-printable characters are escaped""" string = prefix + character @@ -129,35 +129,47 @@ def test_parse_invalid_dsn(dsn): @pytest.mark.parametrize("empty", [None, []]) def test_in_app(empty): - assert handle_in_app_impl( - [{"module": "foo"}, {"module": "bar"}], - in_app_include=["foo"], - in_app_exclude=empty, - ) == [{"module": "foo", "in_app": True}, {"module": "bar"}] - - assert handle_in_app_impl( - [{"module": "foo"}, {"module": "bar"}], - in_app_include=["foo"], - in_app_exclude=["foo"], - ) == [{"module": "foo", "in_app": True}, {"module": "bar"}] - - assert handle_in_app_impl( - [{"module": "foo"}, {"module": "bar"}], - in_app_include=empty, - in_app_exclude=["foo"], - ) == [{"module": "foo", "in_app": False}, {"module": "bar", "in_app": True}] + assert ( + handle_in_app_impl( + [{"module": "foo"}, {"module": "bar"}], + in_app_include=["foo"], + in_app_exclude=empty, + ) + == [{"module": "foo", "in_app": True}, {"module": "bar"}] + ) + + assert ( + handle_in_app_impl( + [{"module": "foo"}, {"module": "bar"}], + in_app_include=["foo"], + in_app_exclude=["foo"], + ) + == [{"module": "foo", "in_app": True}, {"module": "bar"}] + ) + + assert ( + handle_in_app_impl( + [{"module": "foo"}, {"module": "bar"}], + in_app_include=empty, + in_app_exclude=["foo"], + ) + == [{"module": "foo", "in_app": False}, {"module": "bar", "in_app": True}] + ) def test_iter_stacktraces(): - assert set( - iter_event_stacktraces( - { - "threads": {"values": [{"stacktrace": 1}]}, - "stacktrace": 2, - "exception": {"values": [{"stacktrace": 3}]}, - } + assert ( + set( + iter_event_stacktraces( + { + "threads": {"values": [{"stacktrace": 1}]}, + "stacktrace": 2, + "exception": {"values": [{"stacktrace": 3}]}, + } + ) ) - ) == {1, 2, 3} + == {1, 2, 3} + ) @pytest.mark.parametrize( @@ -166,15 +178,15 @@ def test_iter_stacktraces(): # ascii only ("Dogs are great!", "RG9ncyBhcmUgZ3JlYXQh"), # emoji - ("🐶", "8J+Qtg=="), + (u"🐶", "8J+Qtg=="), # non-ascii ( - "Καλό κορίτσι, Μάιζεϊ!", + u"Καλό κορίτσι, Μάιζεϊ!", "zprOsc67z4wgzrrOv8+Bzq/PhM+DzrksIM6czqzOuc62zrXPiiE=", ), # mix of ascii and non-ascii ( - "Of margir hundar! Ég geri ráð fyrir að ég þurfi stærra rúm.", + u"Of margir hundar! Ég geri ráð fyrir að ég þurfi stærra rúm.", "T2YgbWFyZ2lyIGh1bmRhciEgw4lnIGdlcmkgcsOhw7AgZnlyaXIgYcOwIMOpZyDDvnVyZmkgc3TDpnJyYSByw7ptLg==", ), ], From 54769bf3ed5052fc5c8631ea512aa4fd07e0758b Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Wed, 30 Mar 2022 22:21:24 +0200 Subject: [PATCH 4/7] Only reformat non critical code. --- sentry_sdk/client.py | 1 - sentry_sdk/hub.py | 1 - sentry_sdk/integrations/_wsgi_common.py | 4 +- sentry_sdk/integrations/django/__init__.py | 3 +- sentry_sdk/integrations/pyramid.py | 1 - sentry_sdk/integrations/wsgi.py | 1 - sentry_sdk/serializer.py | 6 +- sentry_sdk/tracing.py | 38 +++++++----- sentry_sdk/utils.py | 10 ++- tests/conftest.py | 1 - tests/integrations/bottle/test_bottle.py | 2 +- tests/integrations/django/myapp/views.py | 1 - tests/integrations/django/test_basic.py | 8 +-- tests/test_client.py | 4 +- tests/test_serializer.py | 2 + tests/utils/test_general.py | 72 ++++++++++------------ 16 files changed, 75 insertions(+), 80 deletions(-) diff --git a/sentry_sdk/client.py b/sentry_sdk/client.py index 1720993c1a..efc8799c00 100644 --- a/sentry_sdk/client.py +++ b/sentry_sdk/client.py @@ -451,7 +451,6 @@ class get_options(ClientConstructor, Dict[str, Any]): # noqa: N801 class Client(ClientConstructor, _Client): pass - else: # Alias `get_options` for actual usage. Go through the lambda indirection # to throw PyCharm off of the weakly typed signature (it would otherwise diff --git a/sentry_sdk/hub.py b/sentry_sdk/hub.py index addca57417..22f3ff42fd 100644 --- a/sentry_sdk/hub.py +++ b/sentry_sdk/hub.py @@ -120,7 +120,6 @@ def _init(*args, **kwargs): class init(ClientConstructor, ContextManager[Any]): # noqa: N801 pass - else: # Alias `init` for actual usage. Go through the lambda indirection to throw # PyCharm off of the weakly typed signature (it would otherwise discover diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index f4cc7672e9..4f253acc35 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -39,8 +39,8 @@ def request_body_within_bounds(client, content_length): bodies = client.options["request_bodies"] return not ( bodies == "never" - or (bodies == "small" and content_length > 10 ** 3) - or (bodies == "medium" and content_length > 10 ** 4) + or (bodies == "small" and content_length > 10**3) + or (bodies == "medium" and content_length > 10**4) ) diff --git a/sentry_sdk/integrations/django/__init__.py b/sentry_sdk/integrations/django/__init__.py index db90918529..7eb91887df 100644 --- a/sentry_sdk/integrations/django/__init__.py +++ b/sentry_sdk/integrations/django/__init__.py @@ -69,7 +69,6 @@ def is_authenticated(request_user): # type: (Any) -> bool return request_user.is_authenticated() - else: def is_authenticated(request_user): @@ -202,7 +201,7 @@ def _django_queryset_repr(value, hint): # querysets. This might be surprising to the user but it's likely # less annoying. - return u"<%s from %s at 0x%x>" % ( + return "<%s from %s at 0x%x>" % ( value.__class__.__name__, value.__module__, id(value), diff --git a/sentry_sdk/integrations/pyramid.py b/sentry_sdk/integrations/pyramid.py index 980d56bb6f..07142254d2 100644 --- a/sentry_sdk/integrations/pyramid.py +++ b/sentry_sdk/integrations/pyramid.py @@ -40,7 +40,6 @@ def authenticated_userid(request): # type: (Request) -> Optional[Any] return request.authenticated_userid - else: # bw-compat for pyramid < 1.5 from pyramid.security import authenticated_userid # type: ignore diff --git a/sentry_sdk/integrations/wsgi.py b/sentry_sdk/integrations/wsgi.py index 4f274fa00c..803406fb6d 100644 --- a/sentry_sdk/integrations/wsgi.py +++ b/sentry_sdk/integrations/wsgi.py @@ -46,7 +46,6 @@ def wsgi_decoding_dance(s, charset="utf-8", errors="replace"): # type: (str, str, str) -> str return s.decode(charset, errors) - else: def wsgi_decoding_dance(s, charset="utf-8", errors="replace"): diff --git a/sentry_sdk/serializer.py b/sentry_sdk/serializer.py index 134528cd9a..e657f6b2b8 100644 --- a/sentry_sdk/serializer.py +++ b/sentry_sdk/serializer.py @@ -66,11 +66,11 @@ # Can be overwritten if wanting to send more bytes, e.g. with a custom server. # When changing this, keep in mind that events may be a little bit larger than # this value due to attached metadata, so keep the number conservative. -MAX_EVENT_BYTES = 10 ** 6 +MAX_EVENT_BYTES = 10**6 MAX_DATABAG_DEPTH = 5 MAX_DATABAG_BREADTH = 10 -CYCLE_MARKER = u"" +CYCLE_MARKER = "" global_repr_processors = [] # type: List[ReprProcessor] @@ -228,7 +228,7 @@ def _serialize_node( capture_internal_exception(sys.exc_info()) if is_databag: - return u"" + return "" return None finally: diff --git a/sentry_sdk/tracing.py b/sentry_sdk/tracing.py index 48050350fb..1b5b65e1af 100644 --- a/sentry_sdk/tracing.py +++ b/sentry_sdk/tracing.py @@ -132,14 +132,17 @@ def init_span_recorder(self, maxlen): def __repr__(self): # type: () -> str - return "<%s(op=%r, description:%r, trace_id=%r, span_id=%r, parent_span_id=%r, sampled=%r)>" % ( - self.__class__.__name__, - self.op, - self.description, - self.trace_id, - self.span_id, - self.parent_span_id, - self.sampled, + return ( + "<%s(op=%r, description:%r, trace_id=%r, span_id=%r, parent_span_id=%r, sampled=%r)>" + % ( + self.__class__.__name__, + self.op, + self.description, + self.trace_id, + self.span_id, + self.parent_span_id, + self.sampled, + ) ) def __enter__(self): @@ -515,14 +518,17 @@ def __init__( def __repr__(self): # type: () -> str - return "<%s(name=%r, op=%r, trace_id=%r, span_id=%r, parent_span_id=%r, sampled=%r)>" % ( - self.__class__.__name__, - self.name, - self.op, - self.trace_id, - self.span_id, - self.parent_span_id, - self.sampled, + return ( + "<%s(name=%r, op=%r, trace_id=%r, span_id=%r, parent_span_id=%r, sampled=%r)>" + % ( + self.__class__.__name__, + self.name, + self.op, + self.trace_id, + self.span_id, + self.parent_span_id, + self.sampled, + ) ) @property diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index cc519a58a7..e22f6ae065 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -161,7 +161,7 @@ def __init__(self, value): return parts = urlparse.urlsplit(text_type(value)) - if parts.scheme not in (u"http", u"https"): + if parts.scheme not in ("http", "https"): raise BadDsn("Unsupported scheme %r" % parts.scheme) self.scheme = parts.scheme @@ -280,7 +280,7 @@ def to_header(self, timestamp=None): rv.append(("sentry_client", self.client)) if self.secret_key is not None: rv.append(("sentry_secret", self.secret_key)) - return u"Sentry " + u", ".join("%s=%s" % (key, value) for key, value in rv) + return "Sentry " + ", ".join("%s=%s" % (key, value) for key, value in rv) class AnnotatedValue(object): @@ -440,8 +440,7 @@ def safe_repr(value): return rv except Exception: # If e.g. the call to `repr` already fails - return u"" - + return "" else: @@ -606,7 +605,6 @@ def walk_exception_chain(exc_info): exc_value = cause tb = getattr(cause, "__traceback__", None) - else: def walk_exception_chain(exc_info): @@ -772,7 +770,7 @@ def strip_string(value, max_length=None): if length > max_length: return AnnotatedValue( - value=value[: max_length - 3] + u"...", + value=value[: max_length - 3] + "...", metadata={ "len": length, "rem": [["!limit", "x", max_length - 3, max_length]], diff --git a/tests/conftest.py b/tests/conftest.py index 692a274d71..61f25d98ee 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -39,7 +39,6 @@ def benchmark(): return lambda x: x() - else: del pytest_benchmark diff --git a/tests/integrations/bottle/test_bottle.py b/tests/integrations/bottle/test_bottle.py index 16aacb55c5..ec133e4d75 100644 --- a/tests/integrations/bottle/test_bottle.py +++ b/tests/integrations/bottle/test_bottle.py @@ -196,7 +196,7 @@ def index(): assert len(event["request"]["data"]["foo"]) == 512 -@pytest.mark.parametrize("input_char", [u"a", b"a"]) +@pytest.mark.parametrize("input_char", ["a", b"a"]) def test_too_large_raw_request( sentry_init, input_char, capture_events, app, get_client ): diff --git a/tests/integrations/django/myapp/views.py b/tests/integrations/django/myapp/views.py index cac881552c..02c67ca150 100644 --- a/tests/integrations/django/myapp/views.py +++ b/tests/integrations/django/myapp/views.py @@ -29,7 +29,6 @@ def rest_hello(request): def rest_permission_denied_exc(request): raise PermissionDenied("bye") - except ImportError: pass diff --git a/tests/integrations/django/test_basic.py b/tests/integrations/django/test_basic.py index cc77c9a76a..6106131375 100644 --- a/tests/integrations/django/test_basic.py +++ b/tests/integrations/django/test_basic.py @@ -576,15 +576,15 @@ def test_template_exception( if with_executing_integration: assert filenames[-3:] == [ - (u"Parser.parse", u"django.template.base"), + ("Parser.parse", "django.template.base"), (None, None), - (u"Parser.invalid_block_tag", u"django.template.base"), + ("Parser.invalid_block_tag", "django.template.base"), ] else: assert filenames[-3:] == [ - (u"parse", u"django.template.base"), + ("parse", "django.template.base"), (None, None), - (u"invalid_block_tag", u"django.template.base"), + ("invalid_block_tag", "django.template.base"), ] diff --git a/tests/test_client.py b/tests/test_client.py index 9137f4115a..c8dd6955fe 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -496,7 +496,9 @@ def test_scope_initialized_before_client(sentry_init, capture_events): def test_weird_chars(sentry_init, capture_events): sentry_init() events = capture_events() + # fmt: off capture_message(u"föö".encode("latin1")) + # fmt: on (event,) = events assert json.loads(json.dumps(event)) == event @@ -812,7 +814,7 @@ def __repr__(self): "dsn", [ "http://894b7d594095440f8dfea9b300e6f572@localhost:8000/2", - u"http://894b7d594095440f8dfea9b300e6f572@localhost:8000/2", + "http://894b7d594095440f8dfea9b300e6f572@localhost:8000/2", ], ) def test_init_string_types(dsn, sentry_init): diff --git a/tests/test_serializer.py b/tests/test_serializer.py index 1cc20c4b4a..f5ecc7560e 100644 --- a/tests/test_serializer.py +++ b/tests/test_serializer.py @@ -50,7 +50,9 @@ def inner(message, **kwargs): def test_bytes_serialization_decode(message_normalizer): binary = b"abc123\x80\xf0\x9f\x8d\x95" result = message_normalizer(binary, should_repr_strings=False) + # fmt: off assert result == u"abc123\ufffd\U0001f355" + # fmt: on @pytest.mark.xfail(sys.version_info < (3,), reason="Known safe_repr bugs in Py2.7") diff --git a/tests/utils/test_general.py b/tests/utils/test_general.py index 03be52ca17..b85975b4bb 100644 --- a/tests/utils/test_general.py +++ b/tests/utils/test_general.py @@ -31,19 +31,23 @@ def test_safe_repr_never_broken_for_strings(x): r = safe_repr(x) assert isinstance(r, text_type) - assert u"broken repr" not in r + assert "broken repr" not in r def test_safe_repr_regressions(): + # fmt: off assert u"лошадь" in safe_repr(u"лошадь") + # fmt: on @pytest.mark.xfail( sys.version_info < (3,), reason="Fixing this in Python 2 would break other behaviors", ) -@pytest.mark.parametrize("prefix", (u"", u"abcd", u"лошадь")) +# fmt: off +@pytest.mark.parametrize("prefix", ("", "abcd", u"лошадь")) @pytest.mark.parametrize("character", u"\x00\x07\x1b\n") +# fmt: on def test_safe_repr_non_printable(prefix, character): """Check that non-printable characters are escaped""" string = prefix + character @@ -129,49 +133,38 @@ def test_parse_invalid_dsn(dsn): @pytest.mark.parametrize("empty", [None, []]) def test_in_app(empty): - assert ( - handle_in_app_impl( - [{"module": "foo"}, {"module": "bar"}], - in_app_include=["foo"], - in_app_exclude=empty, - ) - == [{"module": "foo", "in_app": True}, {"module": "bar"}] - ) - - assert ( - handle_in_app_impl( - [{"module": "foo"}, {"module": "bar"}], - in_app_include=["foo"], - in_app_exclude=["foo"], - ) - == [{"module": "foo", "in_app": True}, {"module": "bar"}] - ) - - assert ( - handle_in_app_impl( - [{"module": "foo"}, {"module": "bar"}], - in_app_include=empty, - in_app_exclude=["foo"], - ) - == [{"module": "foo", "in_app": False}, {"module": "bar", "in_app": True}] - ) + assert handle_in_app_impl( + [{"module": "foo"}, {"module": "bar"}], + in_app_include=["foo"], + in_app_exclude=empty, + ) == [{"module": "foo", "in_app": True}, {"module": "bar"}] + + assert handle_in_app_impl( + [{"module": "foo"}, {"module": "bar"}], + in_app_include=["foo"], + in_app_exclude=["foo"], + ) == [{"module": "foo", "in_app": True}, {"module": "bar"}] + + assert handle_in_app_impl( + [{"module": "foo"}, {"module": "bar"}], + in_app_include=empty, + in_app_exclude=["foo"], + ) == [{"module": "foo", "in_app": False}, {"module": "bar", "in_app": True}] def test_iter_stacktraces(): - assert ( - set( - iter_event_stacktraces( - { - "threads": {"values": [{"stacktrace": 1}]}, - "stacktrace": 2, - "exception": {"values": [{"stacktrace": 3}]}, - } - ) + assert set( + iter_event_stacktraces( + { + "threads": {"values": [{"stacktrace": 1}]}, + "stacktrace": 2, + "exception": {"values": [{"stacktrace": 3}]}, + } ) - == {1, 2, 3} - ) + ) == {1, 2, 3} +# fmt: off @pytest.mark.parametrize( ("original", "base64_encoded"), [ @@ -191,6 +184,7 @@ def test_iter_stacktraces(): ), ], ) +# fmt: on def test_successful_base64_conversion(original, base64_encoded): # all unicode characters should be handled correctly assert to_base64(original) == base64_encoded From 2c2890239e1c8d2e81fdf86bfec87a56947051c7 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Thu, 31 Mar 2022 14:29:02 +0200 Subject: [PATCH 5/7] fix(tests): pin werkzeug to a working version. --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index ea8333ca16..b5c22dda43 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,7 +2,7 @@ pytest<7 pytest-forked<=1.4.0 pytest-watch==4.2.0 tox==3.7.0 -Werkzeug +Werkzeug==2.0.3 pytest-localserver==0.5.0 pytest-cov==2.8.1 jsonschema==3.2.0 From c53826464d3f140aa7ca7df0948b9b9f3909b868 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Thu, 31 Mar 2022 14:44:44 +0200 Subject: [PATCH 6/7] fix(tests): pinned werkzeug better --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index b5c22dda43..746b10b9b4 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,7 +2,7 @@ pytest<7 pytest-forked<=1.4.0 pytest-watch==4.2.0 tox==3.7.0 -Werkzeug==2.0.3 +Werkzeug<2.1.0 pytest-localserver==0.5.0 pytest-cov==2.8.1 jsonschema==3.2.0 From f9865c6a662d3c46fd0d6013688c9ebec89a71e9 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Thu, 31 Mar 2022 18:56:33 +0200 Subject: [PATCH 7/7] fix(tests): pin flask version to have working tests. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9488b790ca..7db81e1308 100644 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ def get_file_text(file_name): license="BSD", install_requires=["urllib3>=1.10.0", "certifi"], extras_require={ - "flask": ["flask>=0.11", "blinker>=1.1"], + "flask": ["flask>=0.11,<2.1.0", "blinker>=1.1"], "quart": ["quart>=0.16.1", "blinker>=1.1"], "bottle": ["bottle>=0.12.13"], "falcon": ["falcon>=1.4"],