Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put okify results in unique subdirectories to avoid file overwrites #1456

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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