From d0a0b702b713f5b44b5df6589013e513b4feaf91 Mon Sep 17 00:00:00 2001 From: Peter Van Dyken Date: Wed, 17 Apr 2024 13:32:08 -0400 Subject: [PATCH] Fix flaky template tests Tests dry-running the template were sporadically failing. This occurs when multiple tests (running simultaneously via xdist) attempt to install the snakebids repo at the same time, as poetry-dynamic-versioning is not thread safe (since the fs gets modified). Resolve this by copying over the repo into the docker container before installation --- containers/test-template/test-template.sh | 1 + snakebids/tests/test_template.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/containers/test-template/test-template.sh b/containers/test-template/test-template.sh index ba73546a..90dafe69 100755 --- a/containers/test-template/test-template.sh +++ b/containers/test-template/test-template.sh @@ -6,6 +6,7 @@ method="$1" script_name="$2" cp -r /app/* /work +cp -r /snakebids /src script="'${script_name}' tests/data tests/result participant -c1 --skip-bids-validation" case "$method" in "setuptools" ) diff --git a/snakebids/tests/test_template.py b/snakebids/tests/test_template.py index 82f08001..c00d149d 100644 --- a/snakebids/tests/test_template.py +++ b/snakebids/tests/test_template.py @@ -318,7 +318,7 @@ def test_template_dry_runs_successfully( "-v", f"{tmp_path / app_name}:/app", "-v", - f"{request.config.rootpath}:/src", + f"{request.config.rootpath}:/snakebids", "--rm", f"snakebids/test-template:{platform.python_version()}", venv, @@ -356,7 +356,7 @@ def test_template_docs_build(tmp_path: Path, request: pytest.FixtureRequest): "-v", f"{tmp_path / app_name}:/app", "-v", - f"{request.config.rootpath}:/src", + f"{request.config.rootpath}:/snakebids", "--rm", f"snakebids/test-template:{platform.python_version()}", "docs",