File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,21 @@ def test_dev() -> None:
4545 assert "🐍 single_file_app.py" in result .output
4646
4747
48+ def test_dev_no_args_auto_discovery () -> None :
49+ """Test that auto-discovery works when no args and no pyproject.toml entrypoint"""
50+ with changing_dir (assets_path / "default_files" / "default_main" ):
51+ with patch .object (uvicorn , "run" ) as mock_run :
52+ result = runner .invoke (app , ["dev" ]) # No path argument
53+ assert result .exit_code == 0 , result .output
54+ assert mock_run .called
55+ assert mock_run .call_args
56+ assert mock_run .call_args .kwargs ["app" ] == "main:app"
57+ assert mock_run .call_args .kwargs ["host" ] == "127.0.0.1"
58+ assert mock_run .call_args .kwargs ["port" ] == 8000
59+ assert mock_run .call_args .kwargs ["reload" ] is True
60+ assert "Using import string: main:app" in result .output
61+
62+
4863def test_dev_package () -> None :
4964 with changing_dir (assets_path ):
5065 with patch .object (uvicorn , "run" ) as mock_run :
You can’t perform that action at this time.
0 commit comments