Skip to content

Adjust AzureRecordedTestCase.get_resource_name for PYTEST_CURRENT_TEST inconsistency #34757

Open

Description

As described in #22387 (comment), the value of the PYTEST_CURRENT_TEST environment variable can vary depending on how tests are run. AzureRecordedTestCase.get_resource_name relies on the value of this variable to produce unique resource names deterministically, which means that tests could fail in playback if run differently than when they were recorded.

If possible, it would be ideal to remove dependencies on this environment variable (pytest's own documentation states that it shouldn't be relied on for scripting). The difficulty in doing so is that tests using AzureRecordedTestCase.get_resource_name would have to be re-recorded. Also, we would need to find another reliable way to uniquely identify the executing test.

An alternative solution, then, would be to make sure that we consistently use what we expect the value of PYTEST_CURRENT_TEST to be -- which should be "sdk/{service}/{package}/tests/{test_file}.py[::{TestClass}]::{test_method} (call)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

MQThis issue is part of a "milestone of quality" initiative.test-enhancementtest-proxyAnything relating to test-proxy requests or issues.test-reliabilityIssue that causes tests to be unreliable

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions