Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/populate_tox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@
"hypercorn<0.15.0",
],
"py3.8": ["taskgroup==0.0.0a4"],
"py3.6,py3.7": ["importlib_metadata"],
},
"num_versions": 2,
},
Expand Down
359 changes: 182 additions & 177 deletions scripts/populate_tox/package_dependencies.jsonl

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions scripts/populate_tox/releases.jsonl

Large diffs are not rendered by default.

29 changes: 23 additions & 6 deletions tests/integrations/quart/test_quart.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
from sentry_sdk._types import SENSITIVE_DATA_SUBSTITUTE
from sentry_sdk.integrations.logging import LoggingIntegration

try:
from importlib.metadata import version
except ImportError:
from importlib_metadata import version

QUART_VERSION = tuple([int(v) for v in version("quart").split(".")])
Comment thread
alexander-alderman-webb marked this conversation as resolved.


def quart_app_factory():
# These imports are inlined because the `test_quart_flask_patch` testcase
Expand Down Expand Up @@ -399,16 +406,26 @@ async def error_handler(err):

client = app.test_client()

with pytest.raises(ZeroDivisionError):
if QUART_VERSION >= (0, 21, 0):
# Exception propagation behavior changed in 0.21.0
await client.get("/")

event1, event2 = events
(event,) = events

(exception,) = event1["exception"]["values"]
assert exception["type"] == "ValueError"
(exception,) = event["exception"]["values"]
assert exception["type"] == "ValueError"
Comment on lines +409 to +416

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The version parsing for QUART_VERSION uses int() on version parts split by .. This will crash with a ValueError on pre-release versions like "0.21.0b1".
Severity: HIGH

Suggested Fix

Modify the version parsing logic to handle pre-release identifiers. Instead of a simple int() conversion, use a library like packaging.version.parse or manually strip non-numeric suffixes from the version components before converting them to integers. For example: from packaging.version import parse as parse_version; QUART_VERSION = parse_version(version("quart")).release.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: tests/integrations/quart/test_quart.py#L409-L416

Potential issue: The code parses the Quart version string by splitting it on `.` and
converting each part to an integer. This logic does not account for pre-release suffixes
like "a1", "b1", or "rc1". If a pre-release version of Quart is installed, such as
"0.21.0b1", the code will attempt to execute `int("0b1")`, which raises a `ValueError`.
This will cause the entire test suite to fail at module load time, preventing any tests
from running.


exception = event2["exception"]["values"][-1]
assert exception["type"] == "ZeroDivisionError"
else:
with pytest.raises(ZeroDivisionError):
await client.get("/")

event1, event2 = events

(exception,) = event1["exception"]["values"]
assert exception["type"] == "ValueError"

exception = event2["exception"]["values"][-1]
assert exception["type"] == "ZeroDivisionError"


@pytest.mark.asyncio
Expand Down
Loading
Loading