Skip to content

Add pytest coverage for automation/run_automation.py #25

Description

@katherine-stansifer

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions