Skip to content

test: add CLI command smoke coverage - #10

Merged
UtkarshJoshiNtl merged 1 commit into
UtkarshJoshiNtl:mainfrom
beanscg:bean-labs-cli-command-tests
Jul 17, 2026
Merged

UtkarshJoshiNtl merged 1 commit into
UtkarshJoshiNtl:mainfrom
beanscg:bean-labs-cli-command-tests

Conversation

@beanscg

@beanscg beanscg commented Jun 8, 2026

Copy link
Copy Markdown

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 backend
  • astrosis ephemeris --mjd ...
  • astrosis propagate ...
  • astrosis batch <csv>
  • astrosis conjunction --primary <csv> --secondary <csv>

While adding the batch and conjunction tests, the first 7-column CSV data row was being skipped as if it were always a header. _load_csv now 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.py
  • git diff --check HEAD~1 HEAD

Fixes #7

@UtkarshJoshiNtl
UtkarshJoshiNtl requested a review from Copilot July 17, 2026 10:44
@UtkarshJoshiNtl UtkarshJoshiNtl self-assigned this Jul 17, 2026
@UtkarshJoshiNtl
UtkarshJoshiNtl merged commit 6a25a90 into UtkarshJoshiNtl:main Jul 17, 2026
4 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ... for backend, ephemeris, propagate, batch, and conjunction.
  • Update _load_csv to 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 thread astrosis/cli.py
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 thread tests/test_cli.py
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


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.

No tests for the CLI commands

3 participants