aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/asf/asfframework.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/asf/asfframework.py b/test/asf/asfframework.py
index 024d7f0127d..9839ff58543 100644
--- a/test/asf/asfframework.py
+++ b/test/asf/asfframework.py
@@ -853,8 +853,17 @@ class VppAsfTestCase(CPUInterface, unittest.TestCase):
if hasattr(self, "pg_interfaces") and len(self.pg_interfaces) > 0:
testcase_dir = os.path.dirname(self.pg_interfaces[0].out_path)
for p in Path(testcase_dir).glob("pg*.pcap"):
- self.logger.debug(f"Removing {p}")
- p.unlink()
+ retries = 8
+ while retries > 0:
+ retries = retries - 1
+ self.logger.debug(f"Unlinking {p}")
+ try:
+ p.unlink()
+ break
+ except OSError:
+ self.logger.debug(f"OSError: unlinking {p}")
+ self.sleep(0.25, f"{retries} retries left")
+
self.logger.debug(
f"--- END tearDown() {self.__class__.__name__}.{self._testMethodName}('{self._testMethodDoc}') ---"
)