diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/conftest.py b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/conftest.py index 2eee1ac4747d..22655355fd9c 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/conftest.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/conftest.py @@ -1,9 +1,23 @@ import pytest +from devtools_testutils import EnvironmentVariableLoader +# Environment variable keys +ENV_ENDPOINT = "CONVERSATIONS_ENDPOINT" +ENV_KEY = "CONVERSATIONS_KEY" -# autouse=True will trigger this fixture on each pytest run, even if it's not explicitly used by a test method +@pytest.fixture(scope="session") +def conversations_endpoint(environment_variables: EnvironmentVariableLoader) -> str: + """Endpoint for Conversations tests.""" + return environment_variables.get(ENV_ENDPOINT) + +@pytest.fixture(scope="session") +def conversations_key(environment_variables: EnvironmentVariableLoader) -> str: + """API key for Conversations tests.""" + return environment_variables.get(ENV_KEY) + +# autouse=True will trigger this fixture on each pytest run # test_proxy auto-starts the test proxy -# patch_sleep and patch_async_sleep streamline tests by disabling wait times during LRO polling +# patch_sleep and patch_async_sleep remove wait times during polling @pytest.fixture(scope="session", autouse=True) def start_proxy(test_proxy, patch_sleep, patch_async_sleep): - return + return \ No newline at end of file diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics-authoring/tests/conftest.py b/sdk/cognitivelanguage/azure-ai-textanalytics-authoring/tests/conftest.py index 2eee1ac4747d..fdc882e5cf09 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics-authoring/tests/conftest.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics-authoring/tests/conftest.py @@ -1,9 +1,23 @@ import pytest +from devtools_testutils import EnvironmentVariableLoader +# Environment variable keys +ENV_ENDPOINT = "AUTHORING_ENDPOINT" +ENV_KEY = "AUTHORING_KEY" -# autouse=True will trigger this fixture on each pytest run, even if it's not explicitly used by a test method +@pytest.fixture(scope="session") +def authoring_endpoint(environment_variables: EnvironmentVariableLoader) -> str: + """Endpoint for Authoring tests.""" + return environment_variables.get(ENV_ENDPOINT) + +@pytest.fixture(scope="session") +def authoring_key(environment_variables: EnvironmentVariableLoader) -> str: + """API key for Authoring tests.""" + return environment_variables.get(ENV_KEY) + +# autouse=True will trigger this fixture on each pytest run # test_proxy auto-starts the test proxy -# patch_sleep and patch_async_sleep streamline tests by disabling wait times during LRO polling +# patch_sleep and patch_async_sleep remove wait times during polling @pytest.fixture(scope="session", autouse=True) def start_proxy(test_proxy, patch_sleep, patch_async_sleep): - return + return \ No newline at end of file diff --git a/sdk/cognitivelanguage/tests.yml b/sdk/cognitivelanguage/tests.yml index 311ea8717e4f..2897c601cc6d 100644 --- a/sdk/cognitivelanguage/tests.yml +++ b/sdk/cognitivelanguage/tests.yml @@ -18,6 +18,12 @@ extends: AZURE_CONVERSATIONS_DEPLOYMENT_NAME: $(clu-project-deployment) AZURE_CONVERSATIONS_WORKFLOW_PROJECT_NAME: $(clu-workflow-project) AZURE_CONVERSATIONS_WORKFLOW_DEPLOYMENT_NAME: $(clu-workflow-project-deployment) + CONVERSATIONS_ENDPOINT: $(clu-uri) + CONVERSATIONS_KEY: $(clu-key) + AUTHORING_ENDPOINT: $(clu-uri) + AUTHORING_KEY: $(clu-key) + TEXT_ANALYSIS_ENDPOINT: $(ta-uri) + TEXT_ANALYSIS_KEY: $(ta-key) AZURE_SUBSCRIPTION_ID: $(COGNITIVELANGUAGE_SUBSCRIPTION_ID) TEST_MODE: "RunLiveNoRecord" # use when allowing preparers to create the rgs for you AZURE_TEST_RUN_LIVE: 'true'