Context
automation/run_automation.py is the head-container entrypoint that the startOntBasecall Lambda submits to AWS Batch. It currently has no tests — its argparse surface, the Nextflow argv builder, and the in-process seq_import.samplesheet.generate_samplesheet call are all only exercised end-to-end against real deliveries.
Came out of PR #23 review (the refactor from subprocess.run("python -m seq_import …") to a direct import made the lack of test coverage more visible).
Scope
Add a tests/ directory with pytest coverage for automation/run_automation.py:
parse_args — required flags reject missing input; dashed flags map to expected attribute names (--aws-queue → args.aws_queue, etc.).
build_nextflow_cmd — golden-test the argv given a representative (delivery, kit, aws_queue, base_bucket, work_bucket) tuple. Covers the s3://… URL composition and the -profile batch / --barcodes …/supplemental/barcodes.tsv conventions.
main — mock subprocess.run and seq_import.samplesheet.generate_samplesheet (plus boto3.client) and assert: nextflow runs first with check=True and cwd=/workflow; samplesheet generation runs only on nextflow success; the delivery + base-bucket flow through to generate_samplesheet as delivery= / bucket=.
Out of scope
- Integration tests that actually invoke Nextflow or hit S3 — the unit coverage above is the floor; a heavier integration harness can come later if we need it.
Wiring
- Add
pytest to automation/environment.yml (dev-only is fine; we already ship the env into the image).
- Add a GitHub Actions job to
.github/workflows/ that runs pytest on PRs. The existing docker-build.yml is a reasonable template.
Context
automation/run_automation.pyis the head-container entrypoint that thestartOntBasecallLambda submits to AWS Batch. It currently has no tests — its argparse surface, the Nextflow argv builder, and the in-processseq_import.samplesheet.generate_samplesheetcall are all only exercised end-to-end against real deliveries.Came out of PR #23 review (the refactor from
subprocess.run("python -m seq_import …")to a direct import made the lack of test coverage more visible).Scope
Add a
tests/directory with pytest coverage forautomation/run_automation.py:parse_args— required flags reject missing input; dashed flags map to expected attribute names (--aws-queue→args.aws_queue, etc.).build_nextflow_cmd— golden-test the argv given a representative(delivery, kit, aws_queue, base_bucket, work_bucket)tuple. Covers thes3://…URL composition and the-profile batch/--barcodes …/supplemental/barcodes.tsvconventions.main— mocksubprocess.runandseq_import.samplesheet.generate_samplesheet(plusboto3.client) and assert: nextflow runs first withcheck=Trueandcwd=/workflow; samplesheet generation runs only on nextflow success; the delivery + base-bucket flow through togenerate_samplesheetasdelivery=/bucket=.Out of scope
Wiring
pytesttoautomation/environment.yml(dev-only is fine; we already ship the env into the image)..github/workflows/that runspyteston PRs. The existingdocker-build.ymlis a reasonable template.