Skip to content

Commit

Permalink
[Test Proxy] Update environment_variables scope (Azure#26076)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pvaneck authored Sep 14, 2022
1 parent 4760e34 commit 84a4306
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/azure-sdk-tools/devtools_testutils/proxy_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,13 @@ def get_or_record(self, variable: str, default: str) -> str:
return self.variables.setdefault(variable, default)


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

0 comments on commit 84a4306

Please sign in to comment.