@@ -248,18 +248,24 @@ value of `"appId"`, and `AZURE_CLIENT_SECRET` to the value of `"password"`.
248248The test proxy has to be available in order for tests to work; this is done automatically with a ` pytest ` fixture.
249249
250250Create a ` conftest.py ` file within your package's test directory (` sdk/{service}/{package}/tests ` ), and inside it add a
251- session-level fixture that accepts ` devtools_testutils. test_proxy` as a parameter (and has ` autouse ` set to ` True ` ):
251+ session-level fixture that accepts the ` test_proxy ` fixture as a parameter (and has ` autouse ` set to ` True ` ):
252252
253253``` python
254254import pytest
255- from devtools_testutils import test_proxy
256255
257256# autouse=True will trigger this fixture on each pytest run, even if it's not explicitly used by a test method
257+ # test_proxy auto-starts the test proxy
258+ # patch_sleep and patch_async_sleep streamline tests by disabling wait times during LRO polling
258259@pytest.fixture (scope = " session" , autouse = True )
259- def start_proxy (test_proxy ):
260+ def start_proxy (test_proxy , patch_sleep , patch_async_sleep ):
260261 return
261262```
262263
264+ As shown in the example, it's recommended to also request the ` patch_sleep ` and ` patch_async_sleep ` fixtures unless
265+ your tests have a unique need to use ` time.sleep ` or ` asyncio.sleep ` during playback tests (this is unusual). All of
266+ these fixtures are imported by the central [ ` /sdk/conftest.py ` ] [ central_conftest ] , so ` pytest ` will automatically
267+ resolve the references.
268+
263269For more details about how this fixture starts up the test proxy, or the test proxy itself, refer to the
264270[ test proxy migration guide] [ test_proxy_startup ] .
265271
@@ -576,6 +582,7 @@ For information about more advanced testing scenarios, refer to the [advanced te
576582[ azure_cli_service_principal ] : https://docs.microsoft.com/cli/azure/ad/sp?view=azure-cli-latest#az-ad-sp-create-for-rbac
577583[ azure_portal ] : https://portal.azure.com/
578584[ azure_recorded_test_case ] : https://github.com/Azure/azure-sdk-for-python/blob/7e66e3877519a15c1d4304eb69abf0a2281773/tools/azure-sdk-tools/devtools_testutils/azure_recorded_testcase.py#L44
585+ [ central_conftest ] : https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/conftest.py
579586[ env_var_docs ] : https://github.com/Azure/azure-sdk-for-python/tree/main/tools/azure-sdk-tools/devtools_testutils#use-the-environmentvariableloader
580587[ env_var_loader ] : https://github.com/Azure/azure-sdk-for-python/blob/main/tools/azure-sdk-tools/devtools_testutils/envvariable_loader.py
581588[ generate_sas ] : https://github.com/Azure/azure-sdk-for-python/blob/bf4749babb363e2dc972775f4408036e31f361b4/tools/azure-sdk-tools/devtools_testutils/azure_recorded_testcase.py#L196
0 commit comments