Patch sleep in playback for all tests #35670
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Libraries independently have set up their own solutions to disable
time.sleep/asyncio.sleepin playback, since waiting for polling operations is unnecessary in this scenario and can make tests take much longer than they otherwise would. A Dev Center PR made me realize that we never had central documentation of this convention, meaning that new libraries would likely miss out on this.This PR attempts to add
sleep-skipping fixtures to our repository's centralconftest.py, meaning that everyone would be opted in to the patch by default. These fixtures are skipped ifazure-sdk-toolsisn't installed (e.g. for tests inazure-storage-extensions, which are entirely unit tests and don't require the library). Local testing confirms that thistry/exceptis compatible withpytestfixtures and things work as expected.The only problem with the central approach is that I'm not sure how someone could opt out of this behavior. Adding a
pytestcommand flag might work, but this would need to be manually added wheneverpytestis run and wouldn't be very compatible with test-running environments that we have set up, liketox.Core CI run: https://dev.azure.com/azure-sdk/public/_build/results?buildId=3795586&view=results
cc @scbedd
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines