Skip to content
Merged
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
57 changes: 23 additions & 34 deletions tests/integrations/bottle/test_bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from werkzeug.test import Client
from werkzeug.wrappers import Response

import sentry_sdk.integrations.bottle as bottle_sentry


@pytest.fixture(scope="function")
def app(sentry_init):
Expand Down Expand Up @@ -46,7 +44,7 @@ def inner():


def test_has_context(sentry_init, app, capture_events, get_client):
sentry_init(integrations=[bottle_sentry.BottleIntegration()])
sentry_init(integrations=[BottleIntegration()])
events = capture_events()

client = get_client()
Expand Down Expand Up @@ -77,11 +75,7 @@ def test_transaction_style(
capture_events,
get_client,
):
sentry_init(
integrations=[
bottle_sentry.BottleIntegration(transaction_style=transaction_style)
]
)
sentry_init(integrations=[BottleIntegration(transaction_style=transaction_style)])
events = capture_events()

client = get_client()
Expand All @@ -100,7 +94,7 @@ def test_transaction_style(
def test_errors(
sentry_init, capture_exceptions, capture_events, app, debug, catchall, get_client
):
sentry_init(integrations=[bottle_sentry.BottleIntegration()])
sentry_init(integrations=[BottleIntegration()])

app.catchall = catchall
set_debug(mode=debug)
Expand All @@ -127,7 +121,7 @@ def index():


def test_large_json_request(sentry_init, capture_events, app, get_client):
sentry_init(integrations=[bottle_sentry.BottleIntegration()])
sentry_init(integrations=[BottleIntegration()])

data = {"foo": {"bar": "a" * 2000}}

Expand Down Expand Up @@ -157,7 +151,7 @@ def index():

@pytest.mark.parametrize("data", [{}, []], ids=["empty-dict", "empty-list"])
def test_empty_json_request(sentry_init, capture_events, app, data, get_client):
sentry_init(integrations=[bottle_sentry.BottleIntegration()])
sentry_init(integrations=[BottleIntegration()])

@app.route("/", method="POST")
def index():
Expand All @@ -180,7 +174,7 @@ def index():


def test_medium_formdata_request(sentry_init, capture_events, app, get_client):
sentry_init(integrations=[bottle_sentry.BottleIntegration()])
sentry_init(integrations=[BottleIntegration()])

data = {"foo": "a" * 2000}

Expand Down Expand Up @@ -209,9 +203,7 @@ def index():
def test_too_large_raw_request(
sentry_init, input_char, capture_events, app, get_client
):
sentry_init(
integrations=[bottle_sentry.BottleIntegration()], max_request_body_size="small"
)
sentry_init(integrations=[BottleIntegration()], max_request_body_size="small")

data = input_char * 2000

Expand Down Expand Up @@ -239,9 +231,7 @@ def index():


def test_files_and_form(sentry_init, capture_events, app, get_client):
sentry_init(
integrations=[bottle_sentry.BottleIntegration()], max_request_body_size="always"
)
sentry_init(integrations=[BottleIntegration()], max_request_body_size="always")

data = {"foo": "a" * 2000, "file": (BytesIO(b"hello"), "hello.txt")}

Expand Down Expand Up @@ -278,9 +268,7 @@ def index():
def test_json_not_truncated_if_max_request_body_size_is_always(
sentry_init, capture_events, app, get_client
):
sentry_init(
integrations=[bottle_sentry.BottleIntegration()], max_request_body_size="always"
)
sentry_init(integrations=[BottleIntegration()], max_request_body_size="always")

data = {
"key{}".format(i): "value{}".format(i) for i in range(MAX_DATABAG_BREADTH + 10)
Expand Down Expand Up @@ -309,8 +297,8 @@ def index():
@pytest.mark.parametrize(
"integrations",
[
[bottle_sentry.BottleIntegration()],
[bottle_sentry.BottleIntegration(), LoggingIntegration(event_level="ERROR")],
[BottleIntegration()],
[BottleIntegration(), LoggingIntegration(event_level="ERROR")],
],
)
def test_errors_not_reported_twice(
Expand All @@ -324,23 +312,24 @@ def test_errors_not_reported_twice(

@app.route("/")
def index():
try:
1 / 0
except Exception as e:
logger.exception(e)
raise e
1 / 0

events = capture_events()

client = get_client()

with pytest.raises(ZeroDivisionError):
client.get("/")
try:
client.get("/")
except ZeroDivisionError as e:
logger.exception(e)
raise e

assert len(events) == 1


def test_mount(app, capture_exceptions, capture_events, sentry_init, get_client):
sentry_init(integrations=[bottle_sentry.BottleIntegration()])
sentry_init(integrations=[BottleIntegration()])

app.catchall = False

Expand All @@ -367,7 +356,7 @@ def crashing_app(environ, start_response):


def test_error_in_errorhandler(sentry_init, capture_events, app, get_client):
sentry_init(integrations=[bottle_sentry.BottleIntegration()])
sentry_init(integrations=[BottleIntegration()])

set_debug(False)
app.catchall = True
Expand Down Expand Up @@ -397,7 +386,7 @@ def error_handler(err):


def test_bad_request_not_captured(sentry_init, capture_events, app, get_client):
sentry_init(integrations=[bottle_sentry.BottleIntegration()])
sentry_init(integrations=[BottleIntegration()])
events = capture_events()

@app.route("/")
Expand All @@ -412,7 +401,7 @@ def index():


def test_no_exception_on_redirect(sentry_init, capture_events, app, get_client):
sentry_init(integrations=[bottle_sentry.BottleIntegration()])
sentry_init(integrations=[BottleIntegration()])
events = capture_events()

@app.route("/")
Expand All @@ -436,7 +425,7 @@ def test_span_origin(
capture_events,
):
sentry_init(
integrations=[bottle_sentry.BottleIntegration()],
integrations=[BottleIntegration()],
traces_sample_rate=1.0,
)
events = capture_events()
Expand Down
48 changes: 24 additions & 24 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# The file (and all resulting CI YAMLs) then need to be regenerated via
# "scripts/generate-test-files.sh".
#
# Last generated: 2025-06-11T12:20:52.494394+00:00
# Last generated: 2025-06-17T08:49:27.078408+00:00

[tox]
requires =
Expand Down Expand Up @@ -146,9 +146,9 @@ envlist =
{py3.9,py3.11,py3.12}-cohere-v5.15.0

{py3.8,py3.10,py3.11}-huggingface_hub-v0.22.2
{py3.8,py3.10,py3.11}-huggingface_hub-v0.25.2
{py3.8,py3.12,py3.13}-huggingface_hub-v0.28.1
{py3.8,py3.12,py3.13}-huggingface_hub-v0.32.6
{py3.8,py3.11,py3.12}-huggingface_hub-v0.26.5
{py3.8,py3.12,py3.13}-huggingface_hub-v0.30.2
{py3.8,py3.12,py3.13}-huggingface_hub-v0.33.0


# ~~~ DBs ~~~
Expand All @@ -157,7 +157,7 @@ envlist =
{py3.6}-pymongo-v3.5.1
{py3.6,py3.10,py3.11}-pymongo-v3.13.0
{py3.6,py3.9,py3.10}-pymongo-v4.0.2
{py3.9,py3.12,py3.13}-pymongo-v4.13.0
{py3.9,py3.12,py3.13}-pymongo-v4.13.2

{py3.6}-redis_py_cluster_legacy-v1.3.6
{py3.6,py3.7}-redis_py_cluster_legacy-v2.0.0
Expand All @@ -180,7 +180,7 @@ envlist =
{py3.7,py3.12,py3.13}-statsig-v0.55.3
{py3.7,py3.12,py3.13}-statsig-v0.56.0
{py3.7,py3.12,py3.13}-statsig-v0.57.3
{py3.7,py3.12,py3.13}-statsig-v0.58.1
{py3.7,py3.12,py3.13}-statsig-v0.58.2

{py3.8,py3.12,py3.13}-unleash-v6.0.1
{py3.8,py3.12,py3.13}-unleash-v6.1.0
Expand All @@ -201,9 +201,9 @@ envlist =
{py3.8,py3.12,py3.13}-graphene-v3.4.3

{py3.8,py3.10,py3.11}-strawberry-v0.209.8
{py3.8,py3.11,py3.12}-strawberry-v0.230.0
{py3.8,py3.12,py3.13}-strawberry-v0.251.0
{py3.9,py3.12,py3.13}-strawberry-v0.273.0
{py3.8,py3.11,py3.12}-strawberry-v0.231.1
{py3.8,py3.12,py3.13}-strawberry-v0.253.1
{py3.9,py3.12,py3.13}-strawberry-v0.274.0


# ~~~ Network ~~~
Expand Down Expand Up @@ -261,10 +261,10 @@ envlist =
{py3.7}-aiohttp-v3.4.4
{py3.7,py3.8,py3.9}-aiohttp-v3.7.4
{py3.8,py3.12,py3.13}-aiohttp-v3.10.11
{py3.9,py3.12,py3.13}-aiohttp-v3.12.12
{py3.9,py3.12,py3.13}-aiohttp-v3.12.13

{py3.6,py3.7}-bottle-v0.12.25
{py3.8,py3.12,py3.13}-bottle-v0.13.3
{py3.8,py3.12,py3.13}-bottle-v0.13.4

{py3.6}-falcon-v1.4.1
{py3.6,py3.7}-falcon-v2.0.0
Expand Down Expand Up @@ -515,9 +515,9 @@ deps =
cohere-v5.15.0: cohere==5.15.0

huggingface_hub-v0.22.2: huggingface_hub==0.22.2
huggingface_hub-v0.25.2: huggingface_hub==0.25.2
huggingface_hub-v0.28.1: huggingface_hub==0.28.1
huggingface_hub-v0.32.6: huggingface_hub==0.32.6
huggingface_hub-v0.26.5: huggingface_hub==0.26.5
huggingface_hub-v0.30.2: huggingface_hub==0.30.2
huggingface_hub-v0.33.0: huggingface_hub==0.33.0


# ~~~ DBs ~~~
Expand All @@ -526,7 +526,7 @@ deps =
pymongo-v3.5.1: pymongo==3.5.1
pymongo-v3.13.0: pymongo==3.13.0
pymongo-v4.0.2: pymongo==4.0.2
pymongo-v4.13.0: pymongo==4.13.0
pymongo-v4.13.2: pymongo==4.13.2
pymongo: mockupdb

redis_py_cluster_legacy-v1.3.6: redis-py-cluster==1.3.6
Expand All @@ -550,7 +550,7 @@ deps =
statsig-v0.55.3: statsig==0.55.3
statsig-v0.56.0: statsig==0.56.0
statsig-v0.57.3: statsig==0.57.3
statsig-v0.58.1: statsig==0.58.1
statsig-v0.58.2: statsig==0.58.2
statsig: typing_extensions

unleash-v6.0.1: UnleashClient==6.0.1
Expand Down Expand Up @@ -580,13 +580,13 @@ deps =
py3.6-graphene: aiocontextvars

strawberry-v0.209.8: strawberry-graphql[fastapi,flask]==0.209.8
strawberry-v0.230.0: strawberry-graphql[fastapi,flask]==0.230.0
strawberry-v0.251.0: strawberry-graphql[fastapi,flask]==0.251.0
strawberry-v0.273.0: strawberry-graphql[fastapi,flask]==0.273.0
strawberry-v0.231.1: strawberry-graphql[fastapi,flask]==0.231.1
strawberry-v0.253.1: strawberry-graphql[fastapi,flask]==0.253.1
strawberry-v0.274.0: strawberry-graphql[fastapi,flask]==0.274.0
strawberry: httpx
strawberry-v0.209.8: pydantic<2.11
strawberry-v0.230.0: pydantic<2.11
strawberry-v0.251.0: pydantic<2.11
strawberry-v0.231.1: pydantic<2.11
strawberry-v0.253.1: pydantic<2.11


# ~~~ Network ~~~
Expand Down Expand Up @@ -696,13 +696,13 @@ deps =
aiohttp-v3.4.4: aiohttp==3.4.4
aiohttp-v3.7.4: aiohttp==3.7.4
aiohttp-v3.10.11: aiohttp==3.10.11
aiohttp-v3.12.12: aiohttp==3.12.12
aiohttp-v3.12.13: aiohttp==3.12.13
aiohttp: pytest-aiohttp
aiohttp-v3.10.11: pytest-asyncio
aiohttp-v3.12.12: pytest-asyncio
aiohttp-v3.12.13: pytest-asyncio

bottle-v0.12.25: bottle==0.12.25
bottle-v0.13.3: bottle==0.13.3
bottle-v0.13.4: bottle==0.13.4
bottle: werkzeug<2.1.0

falcon-v1.4.1: falcon==1.4.1
Expand Down
Loading