From 5f67d30ec709ea101870d0a91db8953fc49c7810 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Wed, 11 Aug 2021 19:01:04 +0300 Subject: [PATCH] Tests: retrying directory remove if resource is busy. --- test/conftest.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/conftest.py b/test/conftest.py index 87471287..ea3aaf72 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -328,7 +328,14 @@ def run(request): ): os.remove(path) else: - shutil.rmtree(path) + for attempt in range(10): + try: + shutil.rmtree(path) + break + except OSError as err: + if err.errno != 16: + raise + time.sleep(1) # check descriptors