aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Ollivier <cedric.ollivier@orange.com>2024-10-10 13:21:40 +0000
committerGerrit Code Review <gerrit@opnfv.org>2024-10-10 13:21:40 +0000
commit84a47858643e73c87f8a0255595d56999040ec01 (patch)
tree84ad73b8fd3a8c1cf950f5ebae3c50bf3f47ed20
parentb5233ac9479689c1445b7b5d1b58dde4a82ed0a1 (diff)
parent645195ab7129cd838aa164fa1de5b433f54aa048 (diff)
Merge "Clean res dir before running pytest" into stable/2023.2
-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'