test: add CLI command smoke coverage - #10
Merged
UtkarshJoshiNtl merged 1 commit intoJul 17, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds CLI smoke-test coverage for key astrosis command paths (per #7) and adjusts CSV parsing so 7-column state CSVs without a header don’t have their first data row skipped.
Changes:
- Add pytest-based smoke tests that execute
python -m astrosis ...forbackend,ephemeris,propagate,batch, andconjunction. - Update
_load_csvto treat the first 7-column row as data when it parses numerically, while still skipping non-numeric header rows.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/test_cli.py | Adds subprocess-driven smoke tests for major CLI subcommands, including CSV-driven paths. |
| astrosis/cli.py | Adjusts 7-column CSV parsing to avoid dropping the first data row in headerless files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+60
to
64
| except ValueError: | ||
| pass | ||
| for row in reader: | ||
| ids.append(row[0]) | ||
| rows.append([float(x) for x in row[1:7]]) |
Comment on lines
+59
to
+69
| def test_batch_command_runs_csv_state_file(tmp_path): | ||
| states_path = tmp_path / "states.csv" | ||
| write_states_csv(states_path, [["sat-a", 7000, 0, 0, 0, 7.5, 0]]) | ||
|
|
||
| result = run_astrosis("batch", str(states_path), "--dt", "60", "--steps", "1") | ||
|
|
||
| assert_cli_success(result) | ||
| assert "Batch propagated 1 states" in result.stdout | ||
| assert "sat-a" in result.stdout | ||
|
|
||
|
|
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
Adds CLI smoke tests for the command paths listed in #7 and fixes a CSV parsing edge case the tests exposed.
The new tests cover offline command paths for:
astrosis backendastrosis ephemeris --mjd ...astrosis propagate ...astrosis batch <csv>astrosis conjunction --primary <csv> --secondary <csv>While adding the
batchandconjunctiontests, the first 7-column CSV data row was being skipped as if it were always a header._load_csvnow treats the first 7-column row as data when columns 2-7 parse as floats, while still skipping header rows that fail numeric parsing.Validation
/tmp/bean-gh490-astrosis/.venv/bin/python -m pytest tests/test_cli.py -q/tmp/bean-gh490-astrosis/.venv/bin/python -m black --check astrosis/cli.py tests/test_cli.pygit diff --check HEAD~1 HEADFixes #7