Client side tests for analysis-runner - #758
Conversation
Planning PR for the analysis-runner tw mode. No implementation yet — this commit only anchors the branch so reviewers can engage with the design described in the PR body before any code lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MattWellie
left a comment
There was a problem hiding this comment.
Good start. You can push the pre-commit versions even higher - pre-commit in general is at 6.0.0+, mypy has a version v2.1.0.
The get_repository_specific_information method is probably running as part of this call, and will pass if this testing branch is currently pushed to github which is a bit meta. Probably worth adding those checks in, as it's something we'll be re-using in TW... unless we exclusively stick with named workflows, I can't remember if we came to a decision on this.
|
Confirming a few things from playing locally -
in the tests:
-- Feels bad raising these as issues and just... passing them over, lmk if you want to combine on this |
MattWellie
left a comment
There was a problem hiding this comment.
LGTMatt - doesn't touch functional code, adds tests, updates/modernises requirements and packaging. What's not to love? Maybe a version bump and a second approval from software 👀
violetbrina
left a comment
There was a problem hiding this comment.
Thanks so much for your work adding tests to the analysis-runner, a much overdue addition for sure. I have some very minor comments, and I'm not sure if @dancoates or anyone else from @populationgenomics/software-team wants eyes on this as well.
But looking good.
| mock_run_analysis_runner_from_args = mocker.patch( | ||
| 'analysis_runner.cli.run_analysis_runner_from_args', | ||
| ) | ||
| mock_run_cromwell_from_args = mocker.patch( | ||
| 'analysis_runner.cli.run_cromwell_from_args', | ||
| ) | ||
| mock_run_config_from_args = mocker.patch( | ||
| 'analysis_runner.cli.run_config_from_args', | ||
| ) |
There was a problem hiding this comment.
I'd probably make this a fixture given it's used in every test, just to reduce the duplication a little bit.
| .idea/ | ||
| .DS_Store | ||
| .vscode/ | ||
| tmp_review_feedback.md |
There was a problem hiding this comment.
Probably don't need this in the git ignore if it's a temporary artifact? I assume we'd just not commit it in the first place.
There was a problem hiding this comment.
Yeah I fixed this up in the other PR (I believe), but forgot to clean this up here.
| lambda prompt: 'y', # noqa: ARG005 | ||
| ) | ||
| run_analysis_runner(**args) | ||
| assert len(posted_requests) == 4 # noqa:PLR2004 # headers, json, timeout, url |
There was a problem hiding this comment.
I think I'd prefer an actual key or name check here rather than length which is a more fragile test.
| def _perform_version_check() -> None: | ||
| pass |
There was a problem hiding this comment.
Only runs at import time here, it would be better to use the autouse=True pytest fixture. See _no_outbound_requests.
| "bump2version", | ||
| "pre-commit", | ||
| "pylint", | ||
| "ruff~=0.11", |
There was a problem hiding this comment.
I'm sure you just moved the existing requirements over which is great. But if we've upgraded to ruff 0.15 in the pre-commit, we should do the same in the dev dependencies as well.
Also, we should consider adding mypy here as well and also adding the same version in pre-commit. Just to prevent situations where local runs of ruff/mypy are different from the version the pre-commit tool uses.
|
@violetbrina , I believe I've addressed everything, thanks for the feedback. |
| # via hail | ||
| aiosignal==1.4.0 | ||
| # via aiohttp | ||
| analysis-runner[test] @ file:///opt/deps |
There was a problem hiding this comment.
| analysis-runner[test] @ file:///opt/deps | |
| analysis-runner[test] |
This is breaking CI
There was a problem hiding this comment.
I've made a side PR stacked on this branch - it un-nests the analysis-runner [dev] and [test] optional dependencies, and changes how the package is installed in CI.
It also rebuilds the requirements-dev file with uv instead of pip - it should be equivalent, but the file header is explicit about being created with UV Which we may not want
Adding some client side tests for analysis-runner, before I make any changes to include Nextflow tower as a supported dispatch mode.
ALSO centralise dependency management into
pyproject.tomlcli.pyandcli_analysisrunner.py.mypyandruff, as they were quite outdated.pyproject.toml, deletesetup.pyetc, update build references.