Skip to content

Commit c01cf07

Browse files
author
Zhe Yu
committed
tests(cli): fixed some test warnings
1 parent 2c9f01e commit c01cf07

2 files changed

Lines changed: 3 additions & 10 deletions

File tree

tests/test_common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ async def _try_server(url):
629629
return "127.0.0.1" in url or "localhost" in url
630630

631631
mock_process = AsyncMock()
632+
mock_process.terminate = MagicMock()
632633
with (
633634
patch("vectorcode.common.start_server", return_value=mock_process),
634635
patch("vectorcode.common.try_server", side_effect=_try_server),
@@ -639,3 +640,4 @@ async def _try_server(url):
639640
assert len(manager.get_processes()) == 1
640641
await manager.kill_servers()
641642
mock_process.terminate.assert_called_once()
643+
mock_process.wait.assert_awaited()

tests/test_main.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from vectorcode import __version__
66
from vectorcode.cli_utils import CliAction
7-
from vectorcode.main import async_main, main
7+
from vectorcode.main import async_main
88

99

1010
@pytest.mark.asyncio
@@ -317,12 +317,3 @@ async def test_async_main_exception_handling(monkeypatch):
317317
with patch("vectorcode.main.logger") as mock_logger:
318318
assert await async_main() == 1
319319
mock_logger.error.assert_called_once()
320-
321-
322-
def test_main(monkeypatch):
323-
mock_async_main = AsyncMock(return_value=0)
324-
monkeypatch.setattr("vectorcode.main.async_main", mock_async_main)
325-
monkeypatch.setattr("asyncio.run", MagicMock(return_value=0))
326-
327-
result = main()
328-
assert result == 0

0 commit comments

Comments
 (0)