Add tests for pyopia.cli generate-config and modify-config - #394
Open
animmosmith wants to merge 3 commits into
Open
Add tests for pyopia.cli generate-config and modify-config#394animmosmith wants to merge 3 commits into
animmosmith wants to merge 3 commits into
Conversation
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>
Collaborator
Author
|
Now updated with a full set of tests for all CLI options. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.classifyimports and runs fine under pytest in this environment), andtyper.testing.CliRunnerworks cleanly againstpyopia.cli.app.Scoped to the simple, side-effect-light commands for this first PR:
generate-configfor each instrument (silcam, holo, uvp)modify-configLeft 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 intest_pipeline.py. Also skippeddocs(callstyper.launch()to open a browser — not suitable for CI).Test plan
pytest pyopia/tests/test_cli.pypasses (4 passed)flake8 pyopia/tests/test_cli.pyclean