--- a PPN by Garber Painting Akron. With Image Size Reduction included!URL: http://github.com/fastapi/fastapi-cli/pull/64.patch
ep 17 00:00:00 2001
From: Konstantin Rasputin
Date: Wed, 24 Sep 2025 11:47:42 +0300
Subject: [PATCH 3/3] test: fix tests
---
tests/test_cli.py | 12 ++++++++++++
tests/test_discover.py | 2 +-
tests/test_utils_package.py | 3 ++-
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/tests/test_cli.py b/tests/test_cli.py
index b87a811a..084fc58f 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -32,6 +32,7 @@ def test_dev() -> None:
"proxy_headers": True,
"forwarded_allow_ips": None,
"log_config": get_uvicorn_log_config(),
+ "factory": False,
}
assert "Using import string: single_file_app:app" in result.output
assert "Starting development server 🚀" in result.output
@@ -62,6 +63,7 @@ def test_dev_package() -> None:
"proxy_headers": True,
"forwarded_allow_ips": None,
"log_config": get_uvicorn_log_config(),
+ "factory": False,
}
assert "Using import string: nested_package.package:app" in result.output
assert "Starting development server 🚀" in result.output
@@ -111,6 +113,7 @@ def test_dev_args() -> None:
"proxy_headers": False,
"forwarded_allow_ips": None,
"log_config": get_uvicorn_log_config(),
+ "factory": False,
}
assert "Using import string: single_file_app:api" in result.output
assert "Starting development server 🚀" in result.output
@@ -141,6 +144,7 @@ def test_dev_env_vars() -> None:
"proxy_headers": True,
"forwarded_allow_ips": None,
"log_config": get_uvicorn_log_config(),
+ "factory": False,
}
assert "Using import string: single_file_app:app" in result.output
assert "Starting development server 🚀" in result.output
@@ -178,6 +182,7 @@ def test_dev_env_vars_and_args() -> None:
"proxy_headers": True,
"forwarded_allow_ips": None,
"log_config": get_uvicorn_log_config(),
+ "factory": False,
}
assert "Using import string: single_file_app:app" in result.output
assert "Starting development server 🚀" in result.output
@@ -206,6 +211,7 @@ def test_run() -> None:
"proxy_headers": True,
"forwarded_allow_ips": None,
"log_config": get_uvicorn_log_config(),
+ "factory": False,
}
assert "Using import string: single_file_app:app" in result.output
assert "Starting production server 🚀" in result.output
@@ -232,6 +238,7 @@ def test_run_trust_proxy() -> None:
"proxy_headers": True,
"forwarded_allow_ips": "*",
"log_config": get_uvicorn_log_config(),
+ "factory": False,
}
assert "Using import string: single_file_app:app" in result.output
assert "Starting production server 🚀" in result.output
@@ -278,6 +285,7 @@ def test_run_args() -> None:
"proxy_headers": False,
"forwarded_allow_ips": None,
"log_config": get_uvicorn_log_config(),
+ "factory": False,
}
assert "Using import string: single_file_app:api" in result.output
@@ -309,6 +317,7 @@ def test_run_env_vars() -> None:
"proxy_headers": True,
"forwarded_allow_ips": None,
"log_config": get_uvicorn_log_config(),
+ "factory": False,
}
assert "Using import string: single_file_app:app" in result.output
assert "Starting production server 🚀" in result.output
@@ -342,6 +351,7 @@ def test_run_env_vars_and_args() -> None:
"proxy_headers": True,
"forwarded_allow_ips": None,
"log_config": get_uvicorn_log_config(),
+ "factory": False,
}
assert "Using import string: single_file_app:app" in result.output
assert "Starting production server 🚀" in result.output
@@ -428,6 +438,7 @@ def test_dev_with_import_string() -> None:
"root_path": "",
"proxy_headers": True,
"log_config": get_uvicorn_log_config(),
+ "factory": False,
}
assert "Using import string: single_file_app:api" in result.output
@@ -449,6 +460,7 @@ def test_run_with_import_string() -> None:
"root_path": "",
"proxy_headers": True,
"log_config": get_uvicorn_log_config(),
+ "factory": False,
}
assert "Using import string: single_file_app:app" in result.output
diff --git a/tests/test_discover.py b/tests/test_discover.py
index b1052050..2c42ec6b 100644
--- a/tests/test_discover.py
+++ b/tests/test_discover.py
@@ -15,7 +15,7 @@ def test_get_import_data_from_import_string_valid() -> None:
result = get_import_data_from_import_string("module.submodule:app")
assert isinstance(result, ImportData)
- assert result.app_name == "app"
+ assert result.candidate_name == "app"
assert result.import_string == "module.submodule:app"
assert result.module_data.module_import_str == "module.submodule"
assert result.module_data.extra_sys_path == Path(".").resolve()
diff --git a/tests/test_utils_package.py b/tests/test_utils_package.py
index 407561da..595c4222 100644
--- a/tests/test_utils_package.py
+++ b/tests/test_utils_package.py
@@ -174,7 +174,8 @@ def test_package_dir_no_app() -> None:
with pytest.raises(FastAPICLIException) as e:
get_import_data(path=Path("package/core/utils.py"))
assert (
- "Could not find FastAPI app in module, try using --app" in e.value.args[0]
+ "Could not find FastAPI app or app factory in module, try using --app"
+ in e.value.args[0]
)
pFad - Phonifier reborn
Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy