Skip to content

test(cli): Test coverage for CLI commands#311

Merged
blainekasten merged 23 commits intonextfrom
add-cli-tests
Mar 25, 2026
Merged

test(cli): Test coverage for CLI commands#311
blainekasten merged 23 commits intonextfrom
add-cli-tests

Conversation

@blainekasten
Copy link
Contributor

@blainekasten blainekasten commented Mar 23, 2026

Summary

Adds integration-style CLI tests that run the real together binary against the test base URL to verify json mode is pipable to jq, and have tests to protect core business logic on every command.

Tests

  • JSON Mode:tests/cli/test_json_mode_pipeable_to_jq.py
  • Endpoints:tests/cli/test_endpoints.py
  • Models: tests/cli/test_models.py
  • Files: tests/cli/test_files.py
  • Clusters: test_beta_clusters.py
  • Jig: test_beta_jig.py
  • Evals: test_evals.py
  • FT: test_fine_tuning.py
  • Base: test_main.py

CLI / product

  • Fixed json mode on the following commands:
    • together files check
    • together files delete
    • together files list
    • together files retrieve
    • together files upload
    • together fine-tuning cancel
    • together fine-tuning delete
    • together fine-tuning download
    • together fine-tuning list
    • together fine-tuning list-checkpoints
    • together fine-tuning list-events
    • together fine-tuning retrieve
    • together beta clusters create
    • together beta jig list
  • Add --non-interactive mode to clusters create. This will be a future foundation option but right now is needed to make tests work

Other

  • codegen metadata / .stats.yml update from Stainless.
  • uv.lock bump tied to the test/tooling stack.

Test plan

  • ./scripts/test tests/cli -vv

Fixes DX-360

@blainekasten blainekasten force-pushed the add-cli-tests branch 2 times, most recently from 4a32ca0 to 99db80a Compare March 24, 2026 18:41
@blainekasten blainekasten changed the title chore: Add tests for several CLI commands and functionality test(cli): steady/json/dry-run coverage for CLI Mar 24, 2026
@blainekasten blainekasten changed the title test(cli): steady/json/dry-run coverage for CLI test(cli): Test coverage for CLI commands Mar 24, 2026
@blainekasten blainekasten requested a review from zainhas March 25, 2026 01:20
text=True,
)

command_result = run_command(command)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This only checks whether stdout is parseable by jq, not whether the CLI command itself succeeded. Since jq exits 0 on empty input, a command that fails before producing output can still make this test pass; we should assert command_result.returncode == 0 before running jq.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So this was kind of intentional. I didn't specifically care if the command failed or succeeded as much as I wanted to validate that users can script against this command with jq

)
if "y" not in confirm_response.lower():
click.echo(json.dumps({"status": "Cancel not submitted"}, indent=4))
click.echo(json_lib.dumps({"status": "Cancel not submitted"}, indent=4))
Copy link
Collaborator

Choose a reason for hiding this comment

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

When the user types "n" at the interactive prompt (non-JSON mode), this still outputs raw JSON. Should be a plain message here since we're in the interactive (non-json) path: click.echo("Cancel not submitted")

@blainekasten blainekasten requested a review from zainhas March 25, 2026 16:25
):
click.secho("Invalid hardware selected.", fg="red", err=True)
click.echo("\nAvailable hardware options:")
click.secho("Invalid hardware selected.", fg="red", err=True, file=sys.stderr)
Copy link
Collaborator

Choose a reason for hiding this comment

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

both err=True and file=sys.stderr are passed to click.secho. Click's err=True already redirects to stderr. Passing both is redundant and may behave unexpectedly depending on Click version.

can just be err=True

@blainekasten blainekasten merged commit e2eef01 into next Mar 25, 2026
9 checks passed
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.

2 participants