Skip to content

Commit c797560

Browse files
committed
[FIX] fixing runserver testcase's mocking
1 parent 79be2c6 commit c797560

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/test_cli_operations/test_cli.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,12 +606,16 @@ def test_runserver_command(self, temp_dir: str) -> None:
606606
os.chdir(project_path)
607607

608608
# when
609-
with patch("subprocess.run") as mock_run:
609+
with patch("fastapi_fastkit.cli.subprocess.run") as mock_run:
610610
mock_run.return_value.returncode = 0
611611
result = self.runner.invoke(fastkit_cli, ["runserver"])
612612

613613
# then
614-
assert result.exit_code == 0
614+
if result.exit_code != 0:
615+
print(f"Command output: {result.output}")
616+
print(f"Exception: {result.exception}")
617+
assert result.exit_code == 0, f"runserver failed with output: {result.output}"
618+
assert mock_run.called
615619

616620
def test_runserver_no_venv_project(self, temp_dir: str) -> None:
617621
# given

0 commit comments

Comments
 (0)