From 7efecafbb77a49833cf6337d3c9400c789dc79db Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Mon, 7 Jul 2025 10:46:59 -0400 Subject: [PATCH] Update test_cli.py --- tests/cli/test_cli.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.py index 2e9bc4189..281830a90 100644 --- a/tests/cli/test_cli.py +++ b/tests/cli/test_cli.py @@ -95,13 +95,10 @@ class TestVersionCommand: """Test the version command.""" def test_version_command_execution(self): - """Test that version command executes and exits properly.""" - # The version command should exit with code 0 when executed - with pytest.raises(SystemExit) as exc_info: - command, bound, _ = app.parse_args(["version"]) - command() - - assert exc_info.value.code == 0 + """Test that version command executes properly.""" + # The version command should execute without raising SystemExit + command, bound, _ = app.parse_args(["version"]) + command() # Should not raise def test_version_command_parsing(self): """Test that the version command parses arguments correctly.""" @@ -116,11 +113,10 @@ class TestVersionCommand: assert command.__name__ == "version" assert bound.arguments == {"copy": True} - @patch("fastmcp.cli.cli.sys.exit") @patch("fastmcp.cli.cli.pyperclip.copy") @patch("fastmcp.cli.cli.console") def test_version_command_copy_functionality( - self, mock_console, mock_pyperclip_copy, mock_exit + self, mock_console, mock_pyperclip_copy ): """Test that the version command copies to clipboard when --copy is used.""" command, bound, _ = app.parse_args(["version", "--copy"]) @@ -142,7 +138,6 @@ class TestVersionCommand: mock_console.print.assert_called_with( "[green]✓[/green] Version information copied to clipboard" ) - mock_exit.assert_called_once_with(0) class TestDevCommand: