Skip to content

Commit

Permalink
Put okify results in unique subdirectories to avoid file overwrites (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram authored Oct 14, 2024
2 parents 52458fa + a2804d7 commit 1ae172e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/1456.general.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Give regtest okify results unique subdirectories.
13 changes: 12 additions & 1 deletion romancal/regtest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1ae172e

Please sign in to comment.