I couldn't see an existing issue for this, but have noticed it a few times recently.
_____________________________________________________________________ test_env_from_env_autodiscover_from_files[app_factory_future_annot-app_module_random] _____________________________________________________________________
[gw4] linux -- Python 3.8.17 /home/peter/.cache/pypoetry/virtualenvs/litestar-_gLDtdjb-py3.8/bin/python
path = 'any_name.py', app_file_content = '\nfrom __future__ import annotations\n\nfrom litestar import Litestar\n\ndef any_name() -> Litestar:\n return Litestar([])\n\n\ndef func():\n return False\n'
app_file_app_name = 'any_name', create_app_file = <function create_app_file.<locals>._create_app_file at 0x7fd477aa2940>
@pytest.mark.parametrize(
"path",
[
pytest.param("app.py", id="app_file"),
pytest.param("application.py", id="application_file"),
pytest.param("app/main.py", id="app_module"),
pytest.param("app/any_name.py", id="app_module_random"),
pytest.param("application/another_random_name.py", id="application_module_random"),
],
)
def test_env_from_env_autodiscover_from_files(
path: str, app_file_content: str, app_file_app_name: str, create_app_file: CreateAppFileFixture
) -> None:
directory = None
if "/" in path:
directory, path = path.split("/", 1)
tmp_file_path = create_app_file(file=path, directory=directory, content=app_file_content)
env = LitestarEnv.from_env(None)
dotted_path = _path_to_dotted_path(tmp_file_path.relative_to(Path.cwd()))
assert isinstance(env.app, Litestar)
> assert env.app_path == f"{dotted_path}:{app_file_app_name}"
E AssertionError: assert 'app:app' == 'app.any_name:any_name'
E - app.any_name:any_name
E + app:app
/home/peter/PycharmProjects/litestar/tests/unit/test_cli/test_env_resolution.py:78: AssertionError
----------------------------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------------------------
Using Litestar app from app:app
==================================================================================================== short test summary info ====================================================================================================
FAILED tests/unit/test_cli/test_env_resolution.py::test_env_from_env_autodiscover_from_files[app_factory_future_annot-app_module_random] - AssertionError: assert 'app:app' == 'app.any_name:any_name'
==================================================================================== 1 failed, 3223 passed, 42 skipped, 2 xfailed in 40.50s =====================================================================================
No response
# Your MCVE code here
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
"![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"
No response
main
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too