Skip to content

Add tests for pyopia.cli generate-config and modify-config - #394

Open
animmosmith wants to merge 3 commits into
mainfrom
142-cli-tests
Open

Add tests for pyopia.cli generate-config and modify-config#394
animmosmith wants to merge 3 commits into
mainfrom
142-cli-tests

Conversation

@animmosmith

Copy link
Copy Markdown
Collaborator

Summary

First pass at #142. The issue noted TensorFlow had problems running in a pytest environment back in 2023 — that no longer reproduces with current TF/Keras versions (confirmed pyopia.classify imports and runs fine under pytest in this environment), and typer.testing.CliRunner works cleanly against pyopia.cli.app.

Scoped to the simple, side-effect-light commands for this first PR:

  • generate-config for each instrument (silcam, holo, uvp)
  • modify-config

Left for a follow-up: heavier commands (process, init-project, process-realtime) that exercise full pipeline runs and downloads — these would follow the same example-data patterns already used in test_pipeline.py. Also skipped docs (calls typer.launch() to open a browser — not suitable for CI).

Test plan

  • pytest pyopia/tests/test_cli.py passes (4 passed)
  • flake8 pyopia/tests/test_cli.py clean

animmosmith and others added 2 commits June 18, 2026 15:53
First pass at #142. Confirms typer's CliRunner works cleanly under
pytest in this environment, and that the TensorFlow/pytest
incompatibility noted in the issue (filed 2023) no longer applies
with current TF/Keras versions.

Scoped to the simple, side-effect-light commands for now
(generate-config for each instrument, modify-config). Heavier
commands (process, init-project, process-realtime) that exercise
full pipeline runs and downloads are left for a follow-up, following
the example-data patterns already used in test_pipeline.py.
Adds coverage for docs, --version, init-project, process, process-realtime,
merge-mfdata, convert-raw-images, make-montage, and export-to-ecotaxa,
alongside the existing generate-config/modify-config tests.

Commands that need real particle stats/ROI images to exercise (process,
merge-mfdata, convert-raw-images, make-montage, export-to-ecotaxa) share a
single real end-to-end pipeline run against the downloaded SilCam example
image via session-scoped fixtures in conftest.py, consistent with the
real-download/real-processing approach already used in test_pipeline.py and
test_classify.py.

The --version test targets the --version option added in PR #386, which has
not yet merged into main; it will start passing once that PR lands and this
branch is rebased.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@animmosmith animmosmith linked an issue Jul 28, 2026 that may be closed by this pull request
@animmosmith animmosmith self-assigned this Jul 28, 2026
@animmosmith
animmosmith requested a review from emlynjdavies July 28, 2026 17:17
@animmosmith
animmosmith marked this pull request as ready for review July 28, 2026 17:17
@animmosmith

Copy link
Copy Markdown
Collaborator Author

Now updated with a full set of tests for all CLI options.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make tests for pyopia.cli command line

1 participant