Repository navigation
Isolate test runs to avoid cross talks of Nextflow assets - #4175
Conversation
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses intermittent, parallel-test failures caused by shared access to Nextflow’s assets directory by isolating tests and avoiding unnecessary scanning of unrelated cached pipelines.
Changes:
- Add a helper to consistently resolve the Nextflow assets directory (
NXF_ASSETS/NXF_HOME/ default). - Update
get_local_wf()to directly inspect the expected cached workflow path instead of scanning all cached assets. - Update tests to use per-test temporary Nextflow asset directories and add coverage for broken git refs and “don’t scan unrelated repos”.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
nf_core/pipelines/list.py |
Centralizes Nextflow assets directory resolution and makes local-workflow lookup targeted to the requested workflow to avoid cross-test / cross-cache interference. |
tests/pipelines/test_schema.py |
Isolates schema tests by setting NXF_HOME / NXF_ASSETS to temporary directories and restoring environment variables in tearDown(). |
tests/pipelines/test_list.py |
Adds regression tests for broken git refs and ensures get_local_wf() doesn’t scan unrelated cached repos. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@nf-core-bot changelog |
The test was configuring `type(repo.head.commit).hexsha = PropertyMock(...)`, which sets a `hexsha` property on the *Mock class* and can leak into other tests (global side-effect). Instead, assign a small stub object to `repo.head.commit` with a `hexsha` property that raises, or by setting `repo.head` / `repo.head.commit` to a dedicated mock class whose property you patch via `mock.patch.object`. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
BTW I manually updated the changelog because the automated script couldn't run due to |
ca5abca to
b63ced0
Compare
Yes, sorry for that. I fixed the workflow (but it uses pull_request_target so we need to wait for a release to get this fixed), and then i fixed the changelog.md manually (by commenting the problematic table out). so it should work again in the other PRs |
|
No pb. |
Co-authored-by: Matthias Hörtenhuber <mashehu@users.noreply.github.com>
Co-authored-by: Matthias Hörtenhuber <mashehu@users.noreply.github.com>
Co-authored-by: Matthias Hörtenhuber <mashehu@users.noreply.github.com>
I found a problem while working on my other PRs.
tests/pipelines/test_schema.py:test_get_schema_path_namewas intermittently failing and the funny thing is that the log was showing something aboutexoseqwhich is the other test (test_get_schema_path_name_notexist).The error was only happenning on GitHub, which has the
pytest-xdistplugin installed to run tests in parallel. I didn't get the error when running the tests (sequentially).On GitHub, the error went away after a / few reruns.
It turns out there was a race condition between the tests as they both relied on Nextflow's assets directory. My fix is to:
nf_core/pipelines/list.pydirectly look into the expected location of the assets / pipeline.setUpmethod.Original error below from https://github.com/nf-core/tools/actions/runs/23983530419/job/69951649385?pr=4147 :
PR checklist
CHANGELOG.mdis updateddocsis updated