[Misc] Add pytest marker to opt-out of global test cleanup (#3863)

This commit is contained in:
Cade Daniel
2024-04-04 21:54:16 -07:00
committed by GitHub
parent d03d64fd2e
commit e5043a3e75
3 changed files with 11 additions and 4 deletions

View File

@@ -56,11 +56,15 @@ def cleanup():
@pytest.fixture()
def should_do_global_cleanup_after_test() -> bool:
def should_do_global_cleanup_after_test(request) -> bool:
"""Allow subdirectories to skip global cleanup by overriding this fixture.
This can provide a ~10x speedup for non-GPU unit tests since they don't need
to initialize torch.
"""
if request.node.get_closest_marker("skip_global_cleanup"):
return False
return True