From a9a7b1f50d21822652c02a49564b373b4130d289 Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Mon, 26 Jan 2026 09:39:05 -0500 Subject: [PATCH] chore: better testing for validate exit codes --- jetstream/tests/test_cli.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/jetstream/tests/test_cli.py b/jetstream/tests/test_cli.py index dd246cc7..754ffd36 100644 --- a/jetstream/tests/test_cli.py +++ b/jetstream/tests/test_cli.py @@ -196,9 +196,28 @@ def test_validate_private_example_config_no_dataset(self, runner, monkeypatch): config.write(conf) result = runner.invoke(cli.validate_config, ["my_cool_experiment.toml", "--is_private"]) - assert result.exit_code + assert result.exit_code == 1 assert "dataset_id needs to be explicitly set for private experiments" in str(result) + def test_validate_invalid_toml_exit_code(self, runner, monkeypatch): + monkeypatch.setattr("jetstream.cli.ExperimentCollection.from_experimenter", cli_experiments) + with runner.isolated_filesystem(): + conf = dedent( + """ + [experiment + start_date = "2020-12-31" + end_date = "2021-02-01" + start_date = "2020-12-31" + """ + ) + + with open("my_cool_experiment.toml", "w") as config: + config.write(conf) + + result = runner.invoke(cli.validate_config, ["my_cool_experiment.toml"]) + assert result.exit_code == 1 + assert "TomlDecodeError" in str(result) + def test_validate_example_outcome_config(self, runner, monkeypatch): monkeypatch.setattr("jetstream.cli.ExperimentCollection.from_experimenter", cli_experiments) with runner.isolated_filesystem():