Skip to content

Commit 6af8cd4

Browse files
committed
Fix: applied sentry_init_with_reset fixture
1 parent 68aaed6 commit 6af8cd4

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

tests/integrations/spark/test_spark.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
################
2020

2121

22+
@pytest.fixture(scope="function")
23+
def sentry_init_with_reset(sentry_init):
24+
from sentry_sdk.integrations import _processed_integrations
25+
26+
yield lambda: sentry_init(integrations=[SparkIntegration()])
27+
_processed_integrations.remove("spark")
28+
29+
2230
@pytest.fixture(scope="function")
2331
def create_spark_context():
2432
yield lambda: SparkContext(appName="Testing123")
@@ -48,31 +56,26 @@ def test_start_sentry_listener(create_spark_context):
4856
assert gateway._callback_server is not None
4957

5058

51-
def test_initialize_spark_integration(sentry_init, create_spark_context):
52-
sentry_init(integrations=[SparkIntegration()])
53-
create_spark_context()
54-
55-
56-
@patch("sentry_sdk.integrations.spark.spark_driver._activate_integration")
59+
@patch("sentry_sdk.integrations.spark.spark_driver._patch_spark_context_init")
5760
def test_initialize_spark_integration_before_spark_context_init(
58-
mock_activate_integration,
59-
sentry_init,
61+
mock_patch_spark_context_init,
62+
sentry_init_with_reset,
6063
create_spark_context,
6164
):
62-
sentry_init(integrations=[SparkIntegration()])
65+
sentry_init_with_reset()
6366
create_spark_context()
6467

65-
mock_activate_integration.assert_called_once()
68+
mock_patch_spark_context_init.assert_called_once()
6669

6770

6871
@patch("sentry_sdk.integrations.spark.spark_driver._activate_integration")
6972
def test_initialize_spark_integration_after_spark_context_init(
7073
mock_activate_integration,
7174
create_spark_context,
72-
sentry_init,
75+
sentry_init_with_reset,
7376
):
7477
create_spark_context()
75-
sentry_init(integrations=[SparkIntegration()])
78+
sentry_init_with_reset()
7679

7780
mock_activate_integration.assert_called_once()
7881

0 commit comments

Comments
 (0)