@@ -27,31 +27,31 @@ def hookwrapper(itemgetter, **kwargs):
2727 """
2828
2929 @wrapt .decorator
30- def _with_scope (wrapped , instance , args , kwargs ):
30+ def _with_isolation_scope (wrapped , instance , args , kwargs ):
3131 item = itemgetter (* args , ** kwargs )
32- scope = _resolve_scope_marker_value (item .get_closest_marker ("sentry_client" ))
32+ isolation_scope = _resolve_scope_marker_value (item .get_closest_marker ("sentry_client" ))
3333
34- if scope .client .get_integration (PytestIntegration ) is None :
34+ if isolation_scope .client .get_integration (PytestIntegration ) is None :
3535 yield
3636 else :
37- with sentry_sdk .use_scope ( scope ):
37+ with sentry_sdk .use_isolation_scope ( isolation_scope ):
3838 gen = wrapped (* args , ** kwargs )
3939
4040 while True :
4141 try :
42- with sentry_sdk .use_scope ( scope ):
42+ with sentry_sdk .use_isolation_scope ( isolation_scope ):
4343 chunk = next (gen )
4444
4545 y = yield chunk
4646
47- with sentry_sdk .use_scope ( scope ):
47+ with sentry_sdk .use_isolation_scope ( isolation_scope ):
4848 gen .send (y )
4949
5050 except StopIteration :
5151 break
5252
5353 def inner (f ):
54- return pytest .hookimpl (hookwrapper = True , ** kwargs )(_with_scope (f ))
54+ return pytest .hookimpl (hookwrapper = True , ** kwargs )(_with_isolation_scope (f ))
5555
5656 return inner
5757
@@ -89,7 +89,7 @@ def pytest_runtest_call(item):
8989
9090 # We use the full name including parameters because then we can identify
9191 # how often a single test has run as part of the same GITHUB_RUN_ID.
92- with sentry_sdk .continue_trace (dict (sentry_sdk .get_current_scope ().iter_trace_propagation_headers ())):
92+ with sentry_sdk .continue_trace (dict (sentry_sdk .get_isolation_scope ().iter_trace_propagation_headers ())):
9393 with sentry_sdk .start_span (op = op , name = name ) as span :
9494 span .set_attribute ("pytest-sentry.rerun" , is_rerun )
9595 if is_rerun :
@@ -107,7 +107,7 @@ def pytest_fixture_setup(fixturedef, request):
107107 op = "pytest.fixture.setup"
108108 name = "{} {}" .format (op , fixturedef .argname )
109109
110- with sentry_sdk .continue_trace (dict (sentry_sdk .get_current_scope ().iter_trace_propagation_headers ())):
110+ with sentry_sdk .continue_trace (dict (sentry_sdk .get_isolation_scope ().iter_trace_propagation_headers ())):
111111 with sentry_sdk .start_span (op = op , name = name ) as root_span :
112112 root_span .set_tag ("pytest.fixture.scope" , fixturedef .scope )
113113 yield
@@ -135,8 +135,8 @@ def pytest_runtest_makereport(item, call):
135135 call .excinfo
136136 ]
137137
138- scope = _resolve_scope_marker_value (item .get_closest_marker ("sentry_client" ))
139- integration = scope .client .get_integration (PytestIntegration )
138+ isolation_scope = _resolve_scope_marker_value (item .get_closest_marker ("sentry_client" ))
139+ integration = isolation_scope .client .get_integration (PytestIntegration )
140140
141141 if (cur_exc_chain and call .excinfo is None ) or (integration is not None and integration .always_report ):
142142 for exc_info in cur_exc_chain :
0 commit comments