Jeremiah Lowin commited on
Commit
f5b4644
·
1 Parent(s): 4ef7799

Update test_cli.py

Browse files
Files changed (1) hide show
  1. tests/cli/test_cli.py +5 -10
tests/cli/test_cli.py CHANGED
@@ -95,13 +95,10 @@ class TestVersionCommand:
95
  """Test the version command."""
96
 
97
  def test_version_command_execution(self):
98
- """Test that version command executes and exits properly."""
99
- # The version command should exit with code 0 when executed
100
- with pytest.raises(SystemExit) as exc_info:
101
- command, bound, _ = app.parse_args(["version"])
102
- command()
103
-
104
- assert exc_info.value.code == 0
105
 
106
  def test_version_command_parsing(self):
107
  """Test that the version command parses arguments correctly."""
@@ -116,11 +113,10 @@ class TestVersionCommand:
116
  assert command.__name__ == "version"
117
  assert bound.arguments == {"copy": True}
118
 
119
- @patch("fastmcp.cli.cli.sys.exit")
120
  @patch("fastmcp.cli.cli.pyperclip.copy")
121
  @patch("fastmcp.cli.cli.console")
122
  def test_version_command_copy_functionality(
123
- self, mock_console, mock_pyperclip_copy, mock_exit
124
  ):
125
  """Test that the version command copies to clipboard when --copy is used."""
126
  command, bound, _ = app.parse_args(["version", "--copy"])
@@ -142,7 +138,6 @@ class TestVersionCommand:
142
  mock_console.print.assert_called_with(
143
  "[green]✓[/green] Version information copied to clipboard"
144
  )
145
- mock_exit.assert_called_once_with(0)
146
 
147
 
148
  class TestDevCommand:
 
95
  """Test the version command."""
96
 
97
  def test_version_command_execution(self):
98
+ """Test that version command executes properly."""
99
+ # The version command should execute without raising SystemExit
100
+ command, bound, _ = app.parse_args(["version"])
101
+ command() # Should not raise
 
 
 
102
 
103
  def test_version_command_parsing(self):
104
  """Test that the version command parses arguments correctly."""
 
113
  assert command.__name__ == "version"
114
  assert bound.arguments == {"copy": True}
115
 
 
116
  @patch("fastmcp.cli.cli.pyperclip.copy")
117
  @patch("fastmcp.cli.cli.console")
118
  def test_version_command_copy_functionality(
119
+ self, mock_console, mock_pyperclip_copy
120
  ):
121
  """Test that the version command copies to clipboard when --copy is used."""
122
  command, bound, _ = app.parse_args(["version", "--copy"])
 
138
  mock_console.print.assert_called_with(
139
  "[green]✓[/green] Version information copied to clipboard"
140
  )
 
141
 
142
 
143
  class TestDevCommand: