@@ -17,20 +17,18 @@ def test_single_file_main(capsys: CaptureFixture[str]) -> None:
1717 old_sys_path = sys .path .copy ()
1818 with changing_dir (root_path ):
1919 sys .path .insert (0 , str (root_path ))
20- app = importlib .import_module ("app " )
20+ mod = importlib .import_module ("main " )
2121
22- importlib .reload (app )
22+ importlib .reload (mod )
2323 import_string = get_import_string ()
2424 assert import_string == "main:app"
2525
2626 captured = capsys .readouterr ()
2727 assert "Using path main.py" in captured .out
2828 assert "Resolved absolute path" in captured .out
29- assert (
30- "/fastapi-cli/tests/assets/default_files/default_main/main.py" in captured .out
31- )
29+ assert "/tests/assets/default_files/default_main/main.py" in captured .out
3230 assert "Importing from" in captured .out
33- assert "fastapi-cli /tests/assets/default_files/default_main" in captured .out
31+ assert "/tests/assets/default_files/default_main" in captured .out
3432 assert "╭─ Python module file ─╮" in captured .out
3533 assert "│ 🐍 main.py" in captured .out
3634 assert "Importing module main" in captured .out
@@ -46,18 +44,18 @@ def test_single_file_app(capsys: CaptureFixture[str]) -> None:
4644 old_sys_path = sys .path .copy ()
4745 with changing_dir (root_path ):
4846 sys .path .insert (0 , str (root_path ))
49- app = importlib .import_module ("app" )
47+ mod = importlib .import_module ("app" )
5048
51- importlib .reload (app )
49+ importlib .reload (mod )
5250 import_string = get_import_string ()
5351 assert import_string == "app:app"
5452
5553 captured = capsys .readouterr ()
5654 assert "Using path app.py" in captured .out
5755 assert "Resolved absolute path" in captured .out
58- assert "/fastapi-cli/ tests/assets/default_files/default_app/app.py" in captured .out
56+ assert "/tests/assets/default_files/default_app/app.py" in captured .out
5957 assert "Importing from" in captured .out
60- assert "fastapi-cli /tests/assets/default_files/default_app" in captured .out
58+ assert "/tests/assets/default_files/default_app" in captured .out
6159 assert "╭─ Python module file ─╮" in captured .out
6260 assert "│ 🐍 app.py" in captured .out
6361 assert "Importing module app" in captured .out
@@ -73,18 +71,18 @@ def test_single_file_api(capsys: CaptureFixture[str]) -> None:
7371 old_sys_path = sys .path .copy ()
7472 with changing_dir (root_path ):
7573 sys .path .insert (0 , str (root_path ))
76- app = importlib .import_module ("app " )
74+ mod = importlib .import_module ("api " )
7775
78- importlib .reload (app )
76+ importlib .reload (mod )
7977 import_string = get_import_string ()
8078 assert import_string == "api:app"
8179
8280 captured = capsys .readouterr ()
8381 assert "Using path api.py" in captured .out
8482 assert "Resolved absolute path" in captured .out
85- assert "/fastapi-cli/ tests/assets/default_files/default_api/api.py" in captured .out
83+ assert "/tests/assets/default_files/default_api/api.py" in captured .out
8684 assert "Importing from" in captured .out
87- assert "fastapi-cli /tests/assets/default_files/default_api" in captured .out
85+ assert "/tests/assets/default_files/default_api" in captured .out
8886 assert "╭─ Python module file ─╮" in captured .out
8987 assert "│ 🐍 api.py" in captured .out
9088 assert "Importing module api" in captured .out
0 commit comments