diff --git a/changes/1456.general.rst b/changes/1456.general.rst new file mode 100644 index 000000000..435de0242 --- /dev/null +++ b/changes/1456.general.rst @@ -0,0 +1 @@ +Give regtest okify results unique subdirectories. diff --git a/romancal/regtest/conftest.py b/romancal/regtest/conftest.py index 618fd35ca..22c157ade 100644 --- a/romancal/regtest/conftest.py +++ b/romancal/regtest/conftest.py @@ -61,6 +61,16 @@ def postmortem(request, fixturename): return None +def pytest_collection_modifyitems(config, items): + # add the index of each item in the list of items + # this is used below for artifactory_result_path + # to produce a unique result subdirectory for + # each test (even if that test shares a name with + # another test which is the case for parametrized tests). + for i, item in enumerate(items): + item.index = i + + @pytest.fixture(scope="function", autouse=True) def generate_artifactory_json(request, artifactory_repos): """Pytest fixture that leaves behind JSON upload and okify specfiles @@ -78,8 +88,9 @@ def artifactory_result_path(): build_matrix_suffix = os.environ.get("BUILD_MATRIX_SUFFIX", "0") subdir = f"{TODAYS_DATE}_{build_tag}_{build_matrix_suffix}" testname = request.node.originalname or request.node.name + basename = f"{request.node.index}_{testname}" - return os.path.join(results_root, subdir, testname) + os.sep + return os.path.join(results_root, subdir, basename) + os.sep yield # Execute the following at test teardown