aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Ollivier <cedric.ollivier@orange.com>2024-10-10 13:22:33 +0000
committerGerrit Code Review <gerrit@opnfv.org>2024-10-10 13:22:33 +0000
commitf60218d2336d0424e070e19f31e356a2f1d622c2 (patch)
tree0e838d47ac39fba71440932e77f7a3fcfa7c778c
parenta2af0f83d8fa597384046d11886d6201ef7d9d26 (diff)
parentdc60a0beb924b2879a75976e8fcab5de3de5355e (diff)
Merge "Clean res dir before running pytest" into stable/2023.1
-rw-r--r--xtesting/core/pytest.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/xtesting/core/pytest.py b/xtesting/core/pytest.py
index 84d8ac58..a6735f17 100644
--- a/xtesting/core/pytest.py
+++ b/xtesting/core/pytest.py
@@ -12,6 +12,8 @@
import contextlib
import io
import logging
+import os
+import shutil
import time
import pytest
@@ -69,6 +71,8 @@ class Pytest(testcase.TestCase):
status = self.EX_RUN_ERROR
self.start_time = time.time()
try:
+ if os.path.exists(os.path.join(self.dir_results, self.case_name)):
+ shutil.rmtree(os.path.join(self.dir_results, self.case_name))
pydir = kwargs.pop('dir')
options = kwargs.pop('options', {})
options['html'] = f'{self.res_dir}/results.html'