From f7581e12297122fe949f7a7a7b1e55e0d5c352e1 Mon Sep 17 00:00:00 2001 From: JoyboyBrian Date: Thu, 2 Jul 2026 10:43:10 -0700 Subject: [PATCH] Prune obsolete tests --- .../cli_output/workspace_serializer.json | 4 - tests/unit/auth/test_error_messages.py | 70 --------- tests/unit/auth/test_local_config.py | 6 - tests/unit/cli/output/test_error.py | 65 +------- tests/unit/cli/output/test_serializers.py | 6 - tests/unit/cli/test_command_groups.py | 142 +----------------- tests/unit/cli/test_init_json.py | 35 ----- tests/unit/cli/test_secret_commands.py | 13 -- tests/unit/cli/test_workspace_commands.py | 18 --- tests/unit/docs/test_doc_links.py | 3 + tests/unit/platform/api/test_client.py | 22 --- tests/unit/platform/api/test_models.py | 26 ---- tests/unit/platform/cli/test_login.py | 61 -------- tests/unit/platform/cli/test_utils.py | 9 -- .../unit/rollout/test_server_app_metadata.py | 8 - tests/unit/templates/test_cli.py | 20 +-- tests/unit/templates/test_source.py | 28 ---- tests/unit/test_rubric_cli_command.py | 10 -- 18 files changed, 9 insertions(+), 537 deletions(-) delete mode 100644 tests/golden/cli_output/workspace_serializer.json delete mode 100644 tests/unit/cli/test_init_json.py diff --git a/tests/golden/cli_output/workspace_serializer.json b/tests/golden/cli_output/workspace_serializer.json deleted file mode 100644 index 528c86e6..00000000 --- a/tests/golden/cli_output/workspace_serializer.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "schema_version": 1, - "keys": ["id", "name"] -} diff --git a/tests/unit/auth/test_error_messages.py b/tests/unit/auth/test_error_messages.py index 01a30561..e9c111eb 100644 --- a/tests/unit/auth/test_error_messages.py +++ b/tests/unit/auth/test_error_messages.py @@ -8,7 +8,6 @@ from __future__ import annotations from datetime import UTC, datetime, timedelta -from pathlib import Path from unittest.mock import patch import pytest @@ -17,7 +16,6 @@ from osmosis_ai.platform.auth.credentials import Credentials, UserInfo from osmosis_ai.platform.auth.platform_client import ( AuthenticationExpiredError, - PlatformAPIError, ) from osmosis_ai.platform.constants import MSG_ENV_TOKEN_INVALID @@ -35,31 +33,6 @@ def _make_credentials(*, expired: bool = False) -> Credentials: ) -def test_reset_session_deletes_legacy_auth_local_config( - tmp_path: Path, monkeypatch: pytest.MonkeyPatch -) -> None: - from osmosis_ai.platform.auth.local_config import reset_session - - legacy_config = tmp_path / ".config" / "osmosis" / "config.json" - legacy_config.parent.mkdir(parents=True) - legacy_config.write_text( - '{"active_workspace":{"id":"legacy","name":"legacy"}}', - encoding="utf-8", - ) - - monkeypatch.setattr( - "osmosis_ai.platform.auth.local_config.CONFIG_FILE", - legacy_config, - ) - monkeypatch.setattr( - "osmosis_ai.platform.auth.credentials.delete_credentials", lambda: True - ) - - reset_session() - - assert not legacy_config.exists() - - class TestRequireCredentialsMessages: """Test require_credentials() raises the right exception for each state.""" @@ -93,30 +66,6 @@ def test_valid_credentials_returns_them(self, mock_load: object) -> None: assert result is creds -def test_global_active_workspace_helpers_are_not_public_context_api() -> None: - """Production modules must not expose global active workspace context APIs.""" - import osmosis_ai.platform.auth as auth_module - import osmosis_ai.platform.auth.local_config as local_config - import osmosis_ai.platform.auth.platform_client as platform_client - import osmosis_ai.platform.cli.utils as cli_utils - - removed_symbols = [ - (auth_module, "ensure_active_workspace"), - (auth_module, "get_active_workspace"), - (auth_module, "get_active_workspace_id"), - (local_config, "get_active_workspace"), - (local_config, "get_active_workspace_id"), - (local_config, "get_active_workspace_name"), - (local_config, "set_active_workspace"), - (local_config, "clear_active_workspace"), - (platform_client, "ensure_active_workspace"), - (platform_client, "get_active_workspace_id"), - (cli_utils, "_get_active_workspace_name"), - ] - for module, symbol in removed_symbols: - assert not hasattr(module, symbol), f"{module.__name__}.{symbol} remains" - - class TestPlatformRequestMessages: """Test platform_request() error messages for each failure mode.""" @@ -129,25 +78,6 @@ def test_no_credentials_does_not_say_expired(self, _mock: object) -> None: with pytest.raises(CLIError, match="Not logged in"): platform_request("/api/test") - def test_git_scope_required_ignores_legacy_active_workspace_fallback( - self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch - ) -> None: - from osmosis_ai.platform.auth.platform_client import platform_request - - legacy_config = tmp_path / "config.json" - legacy_config.write_text( - '{"active_workspace":{"id":"legacy-ws","name":"legacy-workspace"}}', - encoding="utf-8", - ) - monkeypatch.setattr( - "osmosis_ai.platform.auth.local_config.CONFIG_FILE", - legacy_config, - ) - creds = _make_credentials() - - with pytest.raises(PlatformAPIError, match="explicit git_identity"): - platform_request("/api/test", credentials=creds) - class TestMainExceptionHandlerMessages: """Test that main() maps exceptions to the correct stderr output.""" diff --git a/tests/unit/auth/test_local_config.py b/tests/unit/auth/test_local_config.py index 0f9a81d3..bd11dcbd 100644 --- a/tests/unit/auth/test_local_config.py +++ b/tests/unit/auth/test_local_config.py @@ -19,12 +19,6 @@ def _isolate_config(tmp_path: Path, monkeypatch: pytest.MonkeyPatch): monkeypatch.setattr(local_config, "CONFIG_FILE", config_file) -def test_local_config_does_not_expose_subscription_cache_helpers() -> None: - assert not hasattr(local_config, "clear_workspace_data") - assert not hasattr(local_config, "load_subscription_status") - assert not hasattr(local_config, "save_subscription_status") - - # ── session reset ──────────────────────────────────────────────── diff --git a/tests/unit/cli/output/test_error.py b/tests/unit/cli/output/test_error.py index b6a937b4..99160bed 100644 --- a/tests/unit/cli/output/test_error.py +++ b/tests/unit/cli/output/test_error.py @@ -13,9 +13,9 @@ import typer.core import osmosis_ai.cli.main as cli_main -from osmosis_ai.cli._click_compat import Context, UsageError +from osmosis_ai.cli._click_compat import Context from osmosis_ai.cli.errors import CLIError -from osmosis_ai.cli.main import _handle_cli_error, main +from osmosis_ai.cli.main import main from osmosis_ai.cli.output.error import ( classify_error, command_path_for_error, @@ -36,21 +36,6 @@ def _capture_envelope(err: CLIError) -> dict[str, Any]: return json.loads(buf.getvalue()) -def _capture_json_usage_error_for_argv( - argv: list[str], - capsys: pytest.CaptureFixture[str], -) -> dict[str, Any]: - rc = _handle_cli_error( - UsageError("No such command."), - argv=argv, - exit_code=2, - ) - assert rc == 2 - captured = capsys.readouterr() - assert captured.out == "" - return json.loads(captured.err) - - def test_envelope_keys_match_golden() -> None: envelope = _capture_envelope(CLIError("Bad input.", code="VALIDATION")) expected = json.loads((GOLDEN / "error_envelope.json").read_text(encoding="utf-8")) @@ -148,52 +133,6 @@ def test_command_path_root_when_argv_empty(monkeypatch) -> None: assert command_path_for_error(None) == "" -@pytest.mark.parametrize( - ("argv", "expected_command"), - [ - (["--json", "doctor"], "doctor"), - (["--json", "workspace"], "workspace"), - (["--json", "workspace", "list"], "workspace"), - (["--json", "workspace", "create", "team"], "workspace"), - (["--json", "workspace", "delete", "team"], "workspace"), - (["--json", "workspace", "switch", "team"], "workspace"), - (["--json", "login"], "login"), - (["--json", "logout"], "logout"), - (["--json", "whoami"], "whoami"), - (["--json", "init"], "init"), - (["--json", "link"], "link"), - (["--json", "unlink"], "unlink"), - (["--json", "project", "init"], "project"), - (["--json", "project", "info"], "project"), - (["--json", "project", "list"], "project"), - (["--json", "secret", "list"], "secret list"), - (["--json", "secret", "add", "NAME"], "secret add"), - (["--json", "dataset", "delete", "name"], "dataset delete"), - (["--json", "train", "delete", "run"], "train delete"), - (["--json", "train", "status", "run"], "train status"), - (["--json", "train", "metrics", "run"], "train metrics"), - (["--json", "train", "traces"], "train traces"), - (["--json", "model", "delete", "name"], "model delete"), - (["--json", "deployment", "list"], "deployment"), - (["--json", "deploy", "checkpoint"], "deploy"), - (["--json", "undeploy", "checkpoint"], "undeploy"), - (["--json", "rollout", "validate", "config.toml"], "rollout validate"), - ], -) -def test_json_unknown_removed_command_uses_explicit_main_argv( - argv: list[str], - expected_command: str, - monkeypatch: pytest.MonkeyPatch, - capsys: pytest.CaptureFixture[str], -) -> None: - monkeypatch.setattr("sys.argv", ["osmosis", "--json", "dataset", "list"]) - - envelope = _capture_json_usage_error_for_argv(argv, capsys) - - assert envelope["command"] == expected_command - assert envelope["error"]["code"] == "VALIDATION" - - def test_json_unknown_command_from_main_uses_explicit_argv( monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], diff --git a/tests/unit/cli/output/test_serializers.py b/tests/unit/cli/output/test_serializers.py index f946ccc6..57220301 100644 --- a/tests/unit/cli/output/test_serializers.py +++ b/tests/unit/cli/output/test_serializers.py @@ -161,12 +161,6 @@ def test_serialize_model_keys() -> None: _assert_keys_match_golden(payload, "model_serializer.json") -def test_workspace_serializer_is_not_exported() -> None: - import osmosis_ai.cli.output as output - - assert not hasattr(output, "serialize_workspace") - - def test_serialize_rollout_keys() -> None: rollout = RolloutInfo.from_dict( { diff --git a/tests/unit/cli/test_command_groups.py b/tests/unit/cli/test_command_groups.py index 9a2822b1..68a30abe 100644 --- a/tests/unit/cli/test_command_groups.py +++ b/tests/unit/cli/test_command_groups.py @@ -9,23 +9,8 @@ from osmosis_ai.cli.main import _register_commands, app, main -REMOVED_COMMAND_PROBE = "--__removed-command-probe" ANSI_ESCAPE = re.compile(r"\x1b\[[0-9;]*m") -REMOVED_ROOT_COMMANDS = [ - "project", - "init", - "link", - "unlink", - "login", - "logout", - "whoami", - "workspace", - "deployment", - "deploy", - "undeploy", -] - PRESERVED_ROOT_COMMANDS = [ "auth", "doctor", @@ -67,40 +52,6 @@ ] -REMOVED_COMMANDS = [ - ["workspace", REMOVED_COMMAND_PROBE], - ["workspace", "list", REMOVED_COMMAND_PROBE], - ["workspace", "create", REMOVED_COMMAND_PROBE, "team"], - ["workspace", "delete", REMOVED_COMMAND_PROBE, "team"], - ["workspace", "switch", REMOVED_COMMAND_PROBE, "team"], - ["workspace", "doctor", REMOVED_COMMAND_PROBE], - ["dataset", "delete", REMOVED_COMMAND_PROBE, "data"], - ["train", "delete", REMOVED_COMMAND_PROBE, "run"], - ["train", "status", REMOVED_COMMAND_PROBE, "run"], - ["train", "metrics", REMOVED_COMMAND_PROBE, "run"], - ["train", "traces", REMOVED_COMMAND_PROBE], - ["model", "delete", REMOVED_COMMAND_PROBE, "model"], - ["init", REMOVED_COMMAND_PROBE], - ["link", REMOVED_COMMAND_PROBE], - ["unlink", REMOVED_COMMAND_PROBE], - ["login", REMOVED_COMMAND_PROBE], - ["logout", REMOVED_COMMAND_PROBE], - ["whoami", REMOVED_COMMAND_PROBE], - ["project", REMOVED_COMMAND_PROBE], - ["project", "doctor", REMOVED_COMMAND_PROBE], - ["project", "init", REMOVED_COMMAND_PROBE, "demo"], - ["project", "info", REMOVED_COMMAND_PROBE], - ["project", "list", REMOVED_COMMAND_PROBE], - ["project", "validate", REMOVED_COMMAND_PROBE], - ["deployment", REMOVED_COMMAND_PROBE], - ["deployment", "list", REMOVED_COMMAND_PROBE], - ["deploy", REMOVED_COMMAND_PROBE, "checkpoint"], - ["undeploy", REMOVED_COMMAND_PROBE, "checkpoint"], - ["rollout", "validate", REMOVED_COMMAND_PROBE, "configs/eval/demo.toml"], - ["eval", "cache", "dir", REMOVED_COMMAND_PROBE], -] - - def _root_command_names() -> set[str]: _register_commands() click_command = typer.main.get_command(app) @@ -108,11 +59,7 @@ def _root_command_names() -> set[str]: def _root_help_command_names(output: str) -> set[str]: - expected_command_names = ( - set(REMOVED_ROOT_COMMANDS) - | set(PRESERVED_ROOT_COMMANDS) - | set(HIDDEN_ROOT_COMMANDS) - ) + expected_command_names = set(PRESERVED_ROOT_COMMANDS) | set(HIDDEN_ROOT_COMMANDS) command_names = set() for line in output.splitlines(): cleaned = ANSI_ESCAPE.sub("", line).strip() @@ -132,62 +79,9 @@ def test_preserved_help_commands_exit_zero(args, capfd): assert rc == 0 -@pytest.mark.parametrize("args", REMOVED_COMMANDS) -def test_removed_commands_are_unknown(args, capfd): - rc = main(args) - captured = capfd.readouterr() - - assert rc != 0 - assert "No such command" in captured.err - - -@pytest.mark.parametrize( - "args", - [ - ["workspace", "list", "--help"], - ["workspace", "create", "--help"], - ["workspace", "delete", "--help"], - ["workspace", "switch", "--help"], - ["workspace", "doctor", "--help"], - ["dataset", "delete", "--help"], - ["train", "delete", "--help"], - ["train", "status", "--help"], - ["train", "metrics", "--help"], - ["train", "traces", "--help"], - ["model", "delete", "--help"], - ["init", "--help"], - ["link", "--help"], - ["unlink", "--help"], - ["login", "--help"], - ["logout", "--help"], - ["whoami", "--help"], - ["project", "--help"], - ["project", "doctor", "--help"], - ["project", "init", "--help"], - ["project", "info", "--help"], - ["project", "list", "--help"], - ["project", "validate", "--help"], - ["deployment", "--help"], - ["deploy", "--help"], - ["undeploy", "--help"], - ["rollout", "validate", "--help"], - ["eval", "cache", "dir", "--help"], - ], -) -def test_removed_help_paths_are_unknown(args, capfd): - rc = main(args) - captured = capfd.readouterr() - - assert rc != 0 - assert "No such command" in captured.err - - -def test_root_command_registry_does_not_include_removed_groups_or_aliases(): +def test_root_command_registry_includes_supported_groups(): root_commands = _root_command_names() - for command in REMOVED_ROOT_COMMANDS: - assert command not in root_commands - for command in PRESERVED_ROOT_COMMANDS: assert command in root_commands @@ -195,15 +89,12 @@ def test_root_command_registry_does_not_include_removed_groups_or_aliases(): assert command in root_commands -def test_root_help_surface_does_not_list_removed_groups_or_aliases(capfd): +def test_root_help_surface_lists_supported_groups(capfd): rc = main(["--plain", "--help"]) captured = capfd.readouterr() root_help_commands = _root_help_command_names(captured.out) assert rc == 0 - for command in REMOVED_ROOT_COMMANDS: - assert command not in root_help_commands - for command in PRESERVED_ROOT_COMMANDS: assert command in root_help_commands @@ -211,33 +102,6 @@ def test_root_help_surface_does_not_list_removed_groups_or_aliases(capfd): assert command not in root_help_commands -def test_eval_help_lists_info_not_status(capfd): - rc = main(["--plain", "eval", "--help"]) - captured = capfd.readouterr() - - assert rc == 0 - assert "info" in captured.out - assert "status" not in captured.out - - -@pytest.mark.parametrize( - ("args", "not_expected"), - [ - (["loginn"], "Did you mean 'login'?"), - (["projec"], "Did you mean 'project'?"), - (["workspac"], "Did you mean 'workspace'?"), - (["train", "tracess"], "Did you mean 'traces'?"), - (["deploymen"], "Did you mean 'deployment'?"), - ], -) -def test_fuzzy_suggestions_do_not_offer_removed_commands(args, not_expected, capfd): - rc = main(args) - captured = capfd.readouterr() - - assert rc != 0 - assert not_expected not in captured.err - - def test_help_command_nudges_to_help_flag(capfd): rc = main(["help"]) captured = capfd.readouterr() diff --git a/tests/unit/cli/test_init_json.py b/tests/unit/cli/test_init_json.py deleted file mode 100644 index a08d2e2b..00000000 --- a/tests/unit/cli/test_init_json.py +++ /dev/null @@ -1,35 +0,0 @@ -"""Negative CLI contracts for removed local bootstrap commands.""" - -from __future__ import annotations - -from pathlib import Path - -from osmosis_ai.cli import main as cli - - -def test_top_level_init_json_is_unknown_and_creates_no_workspace_directory( - monkeypatch, tmp_path: Path, capsys -) -> None: - monkeypatch.chdir(tmp_path) - - exit_code = cli.main(["--json", "init", "demo"]) - - captured = capsys.readouterr() - assert exit_code != 0 - assert captured.out == "" - assert not (tmp_path / "demo").exists() - assert not (tmp_path / ".osmosis" / "project.toml").exists() - - -def test_project_init_json_is_unknown_and_creates_no_workspace_directory( - monkeypatch, tmp_path: Path, capsys -) -> None: - monkeypatch.chdir(tmp_path) - - exit_code = cli.main(["--json", "project", "init", "demo"]) - - captured = capsys.readouterr() - assert exit_code != 0 - assert captured.out == "" - assert not (tmp_path / "demo").exists() - assert not (tmp_path / ".osmosis" / "project.toml").exists() diff --git a/tests/unit/cli/test_secret_commands.py b/tests/unit/cli/test_secret_commands.py index b2cb2a41..ea22285f 100644 --- a/tests/unit/cli/test_secret_commands.py +++ b/tests/unit/cli/test_secret_commands.py @@ -812,19 +812,6 @@ def list_environment_secrets( ) -# ── typer wiring ────────────────────────────────────────────────── - - -def test_secret_add_subcommand_is_removed(monkeypatch, capsys) -> None: - _stub_git_context(monkeypatch) - monkeypatch.setenv("SOURCE_VAR", SENTINEL_VALUE) - # The old `add` verb must no longer be a recognized subcommand. - exit_code = cli.main( - ["--json", "secret", "add", "OPENAI_API_KEY", "--env", "SOURCE_VAR"] - ) - assert exit_code != 0 - - def test_secret_delete_defaults_scope_to_personal(monkeypatch, capsys) -> None: """Omitting --scope deletes from personal scope by default.""" _stub_git_context(monkeypatch) diff --git a/tests/unit/cli/test_workspace_commands.py b/tests/unit/cli/test_workspace_commands.py index 47ee9608..32b1c873 100644 --- a/tests/unit/cli/test_workspace_commands.py +++ b/tests/unit/cli/test_workspace_commands.py @@ -35,21 +35,3 @@ def test_doctor_accepts_workspace_directory_path(tmp_path, capsys) -> None: capsys.readouterr() assert rc == 0 - - -def test_project_validate_is_not_registered(tmp_path, capsys) -> None: - workspace_directory = _make_workspace_directory(tmp_path) - - rc = main(["project", "validate", str(workspace_directory)]) - - captured = capsys.readouterr() - assert rc != 0 - assert "No such command" in captured.err - - -def test_workspace_group_is_not_registered(capfd) -> None: - rc = main(["workspace", "--help"]) - captured = capfd.readouterr() - - assert rc != 0 - assert "No such command" in captured.err diff --git a/tests/unit/docs/test_doc_links.py b/tests/unit/docs/test_doc_links.py index 20c9fe58..97a800b5 100644 --- a/tests/unit/docs/test_doc_links.py +++ b/tests/unit/docs/test_doc_links.py @@ -40,6 +40,7 @@ "superpowers", } ) +_EXCLUDED_ROOT_MARKDOWN = frozenset({"AGENTS.md", "CLAUDE.md"}) # [label](target ...) — capture target up to whitespace or the closing paren, # tolerating an optional <...> wrapper. A trailing `"title"` is dropped because @@ -90,6 +91,8 @@ def _discover_markdown_files() -> list[Path]: if d not in _EXCLUDED_DIR_PARTS and not d.endswith(".egg-info") ] for name in filenames: + if Path(dirpath) == _REPO_ROOT and name in _EXCLUDED_ROOT_MARKDOWN: + continue if name.endswith(".md"): files.append(Path(dirpath) / name) return sorted(files) diff --git a/tests/unit/platform/api/test_client.py b/tests/unit/platform/api/test_client.py index 7f91d144..a42daf0b 100644 --- a/tests/unit/platform/api/test_client.py +++ b/tests/unit/platform/api/test_client.py @@ -10,28 +10,6 @@ from osmosis_ai.platform.api.client import OsmosisClient, _safe_path -REMOVED_CLIENT_METHODS = ( - "list_workspaces", - "create_workspace", - "delete_workspace", - "get_workspace_deletion_status", - "delete_dataset", - "get_dataset_affected_resources", - "delete_training_run", - "delete_model", - "get_model_affected_resources", - "rename_checkpoint", - "delete_deployment", -) - - -class TestRemovedClientMethods: - """Destructive API methods must not be exposed by OsmosisClient.""" - - @pytest.mark.parametrize("method_name", REMOVED_CLIENT_METHODS) - def test_removed_method_is_not_exposed(self, method_name: str) -> None: - assert not hasattr(OsmosisClient, method_name) - class TestCreateDataset: """Tests for OsmosisClient.create_dataset request payloads.""" diff --git a/tests/unit/platform/api/test_models.py b/tests/unit/platform/api/test_models.py index 0ee2af46..6b6864e9 100644 --- a/tests/unit/platform/api/test_models.py +++ b/tests/unit/platform/api/test_models.py @@ -31,32 +31,6 @@ UploadInfo, ) -REMOVED_RESPONSE_MODELS = ( - "DeleteTrainingRunResult", - "AffectedTrainingRun", - "DatasetAffectedResources", - "ModelAffectedResources", - "WorkspaceDeletionStatus", - "ProcessCount", - "RenameDeploymentResult", - "DeploymentInfo", - "PaginatedDeployments", - "DeploymentSummary", - "ModelList", - # Renamed to the shared LogEntry / LogsPage models. - "TrainingRunLogEntry", - "TrainingRunLogs", -) - - -class TestRemovedResponseModels: - """Deleted response models must not be exposed by the models module.""" - - @pytest.mark.parametrize("model_name", REMOVED_RESPONSE_MODELS) - def test_removed_response_model_is_not_exposed(self, model_name: str) -> None: - assert not hasattr(api_models, model_name) - - # ============================================================================= # UploadInfo Tests # ============================================================================= diff --git a/tests/unit/platform/cli/test_login.py b/tests/unit/platform/cli/test_login.py index 21bb1567..a4a39e4f 100644 --- a/tests/unit/platform/cli/test_login.py +++ b/tests/unit/platform/cli/test_login.py @@ -287,37 +287,6 @@ def test_login_success_prompts_clone_and_doctor_not_workspace_link( assert "workspace switch" not in rendered -def test_login_omits_switch_commands_for_multiple_workspaces( - monkeypatch, capsys -) -> None: - """Login should not print removed workspace switch or link commands.""" - new_creds = _make_credentials(user_id="user_1") - result = _make_login_result() - - monkeypatch.delenv("OSMOSIS_TOKEN", raising=False) - monkeypatch.setattr("osmosis_ai.platform.auth.load_credentials", lambda: None) - monkeypatch.setattr( - "osmosis_ai.platform.auth.credentials.save_credentials", lambda c: "keyring" - ) - monkeypatch.setattr( - "osmosis_ai.platform.auth.device_login", - lambda **kw: (result, new_creds), - ) - monkeypatch.setattr( - auth_module, - "console", - Console(force_terminal=False, no_color=True, width=100), - ) - - auth_module.login(force=False, token=None) - - rendered = capsys.readouterr().out - assert "Create or open a workspace in the Osmosis Platform" in rendered - assert "osmosis doctor" in rendered - assert "workspace link" not in rendered - assert "workspace switch" not in rendered - - def test_login_next_steps_omit_workspace_specific_guidance(monkeypatch, capsys) -> None: """Login guidance should be generic account bootstrap guidance.""" new_creds = _make_credentials(user_id="user_1") @@ -351,36 +320,6 @@ def test_login_next_steps_omit_workspace_specific_guidance(monkeypatch, capsys) assert "workspace link" not in rendered -def test_login_does_not_attempt_workspace_lookup(monkeypatch) -> None: - """Workspace lookup is removed from the successful login path.""" - new_creds = _make_credentials(user_id="user_1") - result = _make_login_result() - output = io.StringIO() - - monkeypatch.delenv("OSMOSIS_TOKEN", raising=False) - monkeypatch.setattr("osmosis_ai.platform.auth.load_credentials", lambda: None) - monkeypatch.setattr( - "osmosis_ai.platform.auth.credentials.save_credentials", lambda c: "keyring" - ) - monkeypatch.setattr( - "osmosis_ai.platform.auth.device_login", - lambda **kw: (result, new_creds), - ) - - monkeypatch.setattr( - auth_module, - "console", - Console(file=output, force_terminal=False, no_color=True, width=80), - ) - - auth_module.login(force=False, token=None) - - rendered = output.getvalue() - assert "Login Successful" in rendered - assert "Authenticated, but could not load your workspaces yet." not in rendered - assert "osmosis doctor" in rendered - - def test_whoami_prints_local_identity_outside_workspace_directory(monkeypatch) -> None: """whoami should not require workspace directory setup outside repositories.""" creds = _make_credentials(user_id="user_1") diff --git a/tests/unit/platform/cli/test_utils.py b/tests/unit/platform/cli/test_utils.py index 5c6b8458..20b996e1 100644 --- a/tests/unit/platform/cli/test_utils.py +++ b/tests/unit/platform/cli/test_utils.py @@ -23,15 +23,6 @@ ) from osmosis_ai.platform.constants import DEFAULT_PAGE_SIZE - -def test_platform_utils_do_not_import_workspace_mapping_or_subscription_cache() -> None: - import osmosis_ai.platform.cli.utils as utils - - assert not hasattr(utils, "_require_subscription") - assert not hasattr(utils, "load_subscription_status") - assert not hasattr(utils, "save_subscription_status") - - # ── format_size ────────────────────────────────────────────────────── diff --git a/tests/unit/rollout/test_server_app_metadata.py b/tests/unit/rollout/test_server_app_metadata.py index 8d040cf5..d64b97a0 100644 --- a/tests/unit/rollout/test_server_app_metadata.py +++ b/tests/unit/rollout/test_server_app_metadata.py @@ -9,9 +9,7 @@ from osmosis_ai.rollout.server.app import _handle_rollout from osmosis_ai.rollout.types import ( ExecutionRequest, - ExecutionResult, RolloutInitRequest, - RolloutStatus, ) @@ -90,9 +88,3 @@ async def execute( await _handle_rollout(FailingBackend(), _make_init_request({"k": "v"})) assert "http://controller/complete" in posted - - -def test_capturing_backend_smoke(): - """ExecutionResult import is exercised to keep the contract obvious.""" - result = ExecutionResult(status=RolloutStatus.SUCCESS) - assert result.status == RolloutStatus.SUCCESS diff --git a/tests/unit/templates/test_cli.py b/tests/unit/templates/test_cli.py index ef66a71a..4f4dd846 100644 --- a/tests/unit/templates/test_cli.py +++ b/tests/unit/templates/test_cli.py @@ -12,7 +12,7 @@ from osmosis_ai.cli.output import OutputFormat from osmosis_ai.cli.output.context import override_output_context from osmosis_ai.templates import cli as template_cli -from osmosis_ai.templates.cli import _next_steps, apply_command, list_command +from osmosis_ai.templates.cli import apply_command, list_command def _write_workspace_template(root: Path) -> Path: @@ -120,24 +120,6 @@ def test_list_command_empty_message_uses_user_facing_template_terms( # ── apply_command ──────────────────────────────────────────────── -def test_next_steps_use_git_scoped_training_flow() -> None: - next_steps = _next_steps("multiply") - rendered = "\n".join(next_steps) - - assert "Git Sync" not in rendered - assert "project link" not in rendered - assert "project unlink" not in rendered - assert ".osmosis/project.toml" not in rendered - assert "linked workspace" not in rendered - assert "X-Osmosis-Org" not in rendered - assert "osmosis dataset upload data/multiply.jsonl" in next_steps - assert ( - "Edit configs/training/multiply.toml with the uploaded dataset ID and target model" - in next_steps - ) - assert "osmosis train submit configs/training/multiply.toml" in next_steps - - def test_apply_command_writes_directly_into_project_canonical_layout( tmp_path, monkeypatch, workspace_template ) -> None: diff --git a/tests/unit/templates/test_source.py b/tests/unit/templates/test_source.py index 7ea57e07..28087d8a 100644 --- a/tests/unit/templates/test_source.py +++ b/tests/unit/templates/test_source.py @@ -77,34 +77,6 @@ def fake_extractall( assert calls == ["data"] -def test_safe_extract_lets_data_filter_validate_links( - tmp_path: Path, monkeypatch -) -> None: - archive_path = tmp_path / "template.tar" - with tarfile.open(archive_path, "w") as archive: - member = tarfile.TarInfo( - "workspace-template-main/.claude/skills/create-rollouts" - ) - member.type = tarfile.SYMTYPE - member.linkname = "../../.agents/skills/create-rollouts" - archive.addfile(member) - - calls: list[object] = [] - - def fake_extractall( - self, path=".", members=None, *, numeric_owner=False, filter=None - ): - del self, path, members, numeric_owner - calls.append(filter) - - monkeypatch.setattr(tarfile.TarFile, "extractall", fake_extractall) - - with tarfile.open(archive_path, "r") as archive: - source._safe_extract(archive, tmp_path / "extract") - - assert calls == ["data"] - - def test_missing_override_path_uses_user_facing_template_terms( tmp_path: Path, monkeypatch: pytest.MonkeyPatch ) -> None: diff --git a/tests/unit/test_rubric_cli_command.py b/tests/unit/test_rubric_cli_command.py index 783e27ea..468f232d 100644 --- a/tests/unit/test_rubric_cli_command.py +++ b/tests/unit/test_rubric_cli_command.py @@ -214,16 +214,6 @@ def test_without_record_id_returns_indexed_label(self): ) assert record.label(3) == "record[3]" - def test_without_record_id_index_zero(self): - record = RubricRecord( - solution_str="test", - ground_truth=None, - original_input=None, - metadata=None, - record_id=None, - ) - assert record.label(0) == "record[0]" - # ============================================================================= # calculate_statistics Tests