From 063b5f0cb4013bf3945edf162312dbebb5fa4b85 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Thu, 25 Sep 2025 22:51:16 +0300 Subject: [PATCH] [#287] Bug in LocalOperations::rmdirs is fixed --- testgres/operations/local_ops.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/testgres/operations/local_ops.py b/testgres/operations/local_ops.py index c2bed245..4ec92cb9 100644 --- a/testgres/operations/local_ops.py +++ b/testgres/operations/local_ops.py @@ -333,24 +333,24 @@ def rmdirs(self, path, ignore_errors=True, attempts=3, delay=1): assert attempts > 0 assert delay >= 0 - attempt = 0 + a = 0 while True: - assert attempt < attempts - attempt += 1 + assert a < attempts + a += 1 try: rmtree(path) except FileNotFoundError: pass except Exception as e: - if attempt < attempt: + if a < attempts: errMsg = "Failed to remove directory {0} on attempt {1} ({2}): {3}".format( - path, attempt, type(e).__name__, e + path, a, type(e).__name__, e ) logging.warning(errMsg) time.sleep(delay) continue - assert attempt == attempts + assert a == attempts if not ignore_errors: raise