Skip to content

Commit 84a4306

Browse files
authored
[Test Proxy] Update environment_variables scope (Azure#26076)
This updates the environment_variables pytest fixture scope to "session" (as opposed to the default "function" scope) in order to enable users to use it in other session scoped fixtures. Also, for most cases users will only need one instance of EnvironmentVariableSanitizer per test session since the envars won't typically change during the test run. Signed-off-by: Paul Van Eck <[email protected]>
1 parent 4760e34 commit 84a4306

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/azure-sdk-tools/devtools_testutils/proxy_fixtures.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,13 @@ def get_or_record(self, variable: str, default: str) -> str:
9494
return self.variables.setdefault(variable, default)
9595

9696

97-
@pytest.fixture
97+
@pytest.fixture(scope="session")
9898
def environment_variables(test_proxy: None) -> EnvironmentVariableSanitizer:
9999
"""Fixture that returns an EnvironmentVariableSanitizer for convenient environment variable fetching and sanitizing.
100100
101+
This fixture is session-scoped, so a single instance of EnvironmentVariableSanitizer is shared across all
102+
tests using this fixture in the test session.
103+
101104
:param test_proxy: The fixture responsible for starting up the test proxy server.
102105
:type test_proxy: None
103106

0 commit comments

Comments
 (0)