8000 Fixed some tests by antonpirker · Pull Request #4217 · getsentry/sentry-python · GitHub
[go: up one dir, main page]

Skip to content

Fixed some tests #4217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 1, 2025
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
2 changes: 1 addition & 1 deletion tests/integrations/wsgi/test_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def test_app(environ, start_response):

sentry_init(
traces_sample_rate=1.0,
_experiments={"profiles_sample_rate": 1.0},
profiles_sample_rate=1.0,
)
app = SentryWsgiMiddleware(test_app)
envelopes = capture_envelopes()
Expand Down
40 changes: 11 additions & 29 deletions tests/profiler/test_continuous_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,16 @@
requires_gevent = pytest.mark.skipif(gevent is None, reason="gevent not enabled")


def get_client_options(use_top_level_profiler_mode):
def get_client_options():
def client_options(
mode=None, auto_start=None, profile_session_sample_rate=1.0, lifecycle="manual"
):
if use_top_level_profiler_mode:
return {
"profile_lifecycle": lifecycle,
"profiler_mode": mode,
"profile_session_sample_rate": profile_session_sample_rate,
"_experiments": {
"continuous_profiling_auto_start": auto_start,
},
}
return {
"profile_lifecycle": lifecycle,
"profiler_mode": mode,
"profile_session_sample_rate": profile_session_sample_rate,
"_experiments": {
"continuous_profiling_auto_start": auto_start,
"continuous_profiling_mode": mode,
},
}

Expand All @@ -60,8 +51,7 @@ def client_options(
@pytest.mark.parametrize(
"make_options",
[
pytest.param(get_client_options(True), id="non-experiment"),
pytest.param(get_client_options(False), id="experiment"),
pytest.param(get_client_options()),
],
)
def test_continuous_profiler_invalid_mode(mode, make_options, teardown_profiling):
Expand All @@ -83,8 +73,7 @@ def test_continuous_profiler_invalid_mode(mode, make_options, teardown_profiling
@pytest.mark.parametrize(
"make_options",
[
pytest.param(get_client_options(True), id="non-experiment"),
pytest.param(get_client_options(False), id="experiment"),
pytest.param(get_client_options()),
],
)
def test_continuous_profiler_valid_mode(mode, make_options, teardown_profiling):
Expand All @@ -106,8 +95,7 @@ def test_continuous_profiler_valid_mode(mode, make_options, teardown_profiling):
@pytest.mark.parametrize(
"make_options",
[
pytest.param(get_client_options(True), id="non-experiment"),
pytest.param(get_client_options(False), id="experiment"),
pytest.param(get_client_options()),
],
)
def test_continuous_profiler_setup_twice(mode, make_options, teardown_profiling):
Expand Down Expand Up @@ -215,8 +203,7 @@ def assert_single_transaction_without_profile_chunks(envelopes):
@pytest.mark.parametrize(
"make_options",
[
pytest.param(get_client_options(True), id="non-experiment"),
pytest.param(get_client_options(False), id="experiment"),
pytest.param(get_client_options()),
],
)
@mock.patch("sentry_sdk.profiler.continuous_profiler.PROFILE_BUFFER_SECONDS", 0.01)
Expand Down Expand Up @@ -275,8 +262,7 @@ def test_continuous_profiler_auto_start_and_manual_stop(
@pytest.mark.parametrize(
"make_options",
[
pytest.param(get_client_options(True), id="non-experiment"),
pytest.param(get_client_options(False), id="experiment"),
pytest.param(get_client_options()),
],
)
@mock.patch("sentry_sdk.profiler.continuous_profiler.PROFILE_BUFFER_SECONDS", 0.01)
Expand Down Expand Up @@ -340,8 +326,7 @@ def test_continuous_profiler_manual_start_and_stop_sampled(
@pytest.mark.parametrize(
"make_options",
[
pytest.param(get_client_options(True), id="non-experiment"),
pytest.param(get_client_options(False), id="experiment"),
pytest.param(get_client_options()),
],
)
def test_continuous_profiler_manual_start_and_stop_unsampled(
Expand Down Expand Up @@ -382,8 +367,7 @@ def test_continuous_profiler_manual_start_and_stop_unsampled(
@pytest.mark.parametrize(
"make_options",
[
pytest.param(get_client_options(True), id="non-experiment"),
pytest.param(get_client_options(False), id="experiment"),
pytest.param(get_client_options()),
],
)
@mock.patch("sentry_sdk.profiler.continuous_profiler.DEFAULT_SAMPLING_FREQUENCY", 21)
Expand Down Expand Up @@ -444,8 +428,7 @@ def test_continuous_profiler_auto_start_and_stop_sampled(
@pytest.mark.parametrize(
"make_options",
[
pytest.param(get_client_options(True), id="non-experiment"),
pytest.param(get_client_options(False), id="experiment"),
pytest.param(get_client_options()),
],
)
@mock.patch("sentry_sdk.profiler.continuous_profiler.PROFILE_BUFFER_SECONDS", 0.01)
Expand Down Expand Up @@ -493,8 +476,7 @@ def test_continuous_profiler_auto_start_and_stop_unsampled(
@pytest.mark.parametrize(
"make_options",
[
pytest.param(get_client_options(True), id="non-experiment"),
pytest.param(get_client_options(False), id="experiment"),
pytest.param(get_client_options()),
],
)
def test_continuous_profiler_manual_start_and_stop_noop_when_using_trace_lifecyle(
Expand Down
7 changes: 0 additions & 7 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,6 @@ def test_socks_proxy(testcase, http2):
)


def test_simple_transport(sentry_init):
events = []
sentry_init(transport=events.append)
capture_message("Hello World!")
assert events[0]["message"] == "Hello World!"


def test_ignore_errors(sentry_init, capture_events):
sentry_init(ignore_errors=[ZeroDivisionError])
events = capture_events()
Expand Down
Loading
0