Skip to content

Commit 9ad1c23

Browse files
committed
Update tests
1 parent 536a15f commit 9ad1c23

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/test_cli.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def test_dev() -> None:
3838
assert "Configuration sources:" in result.output
3939
assert "Module: path CLI argument" in result.output
4040
assert "App name: auto-discovery" in result.output
41+
assert "You can configure an entrypoint in pyproject.toml" not in result.output
4142
assert "Starting development server 🚀" in result.output
4243
assert "Server started at http://127.0.0.1:8000" in result.output
4344
assert "Documentation at http://127.0.0.1:8000/docs" in result.output
@@ -64,6 +65,9 @@ def test_dev_no_args_auto_discovery() -> None:
6465
assert "Using import string: main:app" in result.output
6566
assert "Configuration sources:" in result.output
6667
assert "Import string: auto-discovery" in result.output
68+
assert "You can configure an entrypoint in pyproject.toml" in result.output
69+
assert "[tool.fastapi]" in result.output
70+
assert 'entrypoint = "main:app"' in result.output
6771

6872

6973
def test_dev_package() -> None:
@@ -88,6 +92,7 @@ def test_dev_package() -> None:
8892
assert "Using import string: nested_package.package:app" in result.output
8993
assert "Module: path CLI argument" in result.output
9094
assert "App name: auto-discovery" in result.output
95+
assert "You can configure an entrypoint in pyproject.toml" not in result.output
9196
assert "Starting development server 🚀" in result.output
9297
assert "Server started at http://127.0.0.1:8000" in result.output
9398
assert "Documentation at http://127.0.0.1:8000/docs" in result.output
@@ -140,6 +145,7 @@ def test_dev_args() -> None:
140145
assert "Using import string: single_file_app:api" in result.output
141146
assert "Module: path CLI argument" in result.output
142147
assert "App name: --app CLI option" in result.output
148+
assert "You can configure an entrypoint in pyproject.toml" not in result.output
143149
assert "Starting development server 🚀" in result.output
144150
assert "Server started at http://192.168.0.2:8080" in result.output
145151
assert "Documentation at http://192.168.0.2:8080/docs" in result.output
@@ -173,6 +179,7 @@ def test_dev_env_vars() -> None:
173179
assert "Using import string: single_file_app:app" in result.output
174180
assert "Module: path CLI argument" in result.output
175181
assert "App name: auto-discovery" in result.output
182+
assert "You can configure an entrypoint in pyproject.toml" not in result.output
176183
assert "Starting development server 🚀" in result.output
177184
assert "Server started at http://127.0.0.1:8111" in result.output
178185
assert "Documentation at http://127.0.0.1:8111/docs" in result.output
@@ -213,6 +220,7 @@ def test_dev_env_vars_and_args() -> None:
213220
assert "Using import string: single_file_app:app" in result.output
214221
assert "Module: path CLI argument" in result.output
215222
assert "App name: auto-discovery" in result.output
223+
assert "You can configure an entrypoint in pyproject.toml" not in result.output
216224
assert "Starting development server 🚀" in result.output
217225
assert "Server started at http://127.0.0.1:8080" in result.output
218226
assert "Documentation at http://127.0.0.1:8080/docs" in result.output
@@ -261,6 +269,7 @@ def test_run() -> None:
261269
assert "Using import string: single_file_app:app" in result.output
262270
assert "Module: path CLI argument" in result.output
263271
assert "App name: auto-discovery" in result.output
272+
assert "You can configure an entrypoint in pyproject.toml" not in result.output
264273
assert "Starting production server 🚀" in result.output
265274
assert "Server started at http://0.0.0.0:8000" in result.output
266275
assert "Documentation at http://0.0.0.0:8000/docs" in result.output
@@ -338,6 +347,7 @@ def test_run_args() -> None:
338347
assert "Using import string: single_file_app:api" in result.output
339348
assert "Module: path CLI argument" in result.output
340349
assert "App name: --app CLI option" in result.output
350+
assert "You can configure an entrypoint in pyproject.toml" not in result.output
341351
assert "Starting production server 🚀" in result.output
342352
assert "Server started at http://192.168.0.2:8080" in result.output
343353
assert "Documentation at http://192.168.0.2:8080/docs" in result.output
@@ -371,6 +381,7 @@ def test_run_env_vars() -> None:
371381
assert "Using import string: single_file_app:app" in result.output
372382
assert "Module: path CLI argument" in result.output
373383
assert "App name: auto-discovery" in result.output
384+
assert "You can configure an entrypoint in pyproject.toml" not in result.output
374385
assert "Starting production server 🚀" in result.output
375386
assert "Server started at http://0.0.0.0:8111" in result.output
376387
assert "Documentation at http://0.0.0.0:8111/docs" in result.output
@@ -407,6 +418,7 @@ def test_run_env_vars_and_args() -> None:
407418
assert "Using import string: single_file_app:app" in result.output
408419
assert "Module: path CLI argument" in result.output
409420
assert "App name: auto-discovery" in result.output
421+
assert "You can configure an entrypoint in pyproject.toml" not in result.output
410422
assert "Starting production server 🚀" in result.output
411423
assert "Server started at http://0.0.0.0:8080" in result.output
412424
assert "Documentation at http://0.0.0.0:8080/docs" in result.output
@@ -520,6 +532,7 @@ def test_dev_with_import_string() -> None:
520532
}
521533
assert "Using import string: single_file_app:api" in result.output
522534
assert "Import string: --entrypoint CLI option" in result.output
535+
assert "You can configure an entrypoint in pyproject.toml" not in result.output
523536

524537

525538
def test_run_with_import_string() -> None:
@@ -543,6 +556,7 @@ def test_run_with_import_string() -> None:
543556
}
544557
assert "Using import string: single_file_app:app" in result.output
545558
assert "Import string: --entrypoint CLI option" in result.output
559+
assert "You can configure an entrypoint in pyproject.toml" not in result.output
546560

547561

548562
def test_script() -> None:

0 commit comments

Comments
 (0)