1010import pytest
1111from asgi_tools .tests import ASGITestClient , manage_lifespan
1212
13+ from muffin .constants import CONFIG_ENV_VARIABLE
14+ from muffin .utils import import_app
15+
1316if TYPE_CHECKING :
1417 from muffin .app import Application
1518
@@ -33,7 +36,6 @@ def pytest_addoption(parser):
3336
3437def pytest_load_initial_conftests (early_config , parser , args ):
3538 """Prepare to loading Muffin application."""
36- from muffin .constants import CONFIG_ENV_VARIABLE
3739
3840 options = parser .parse_known_args (args )
3941
@@ -51,14 +53,12 @@ def pytest_load_initial_conftests(early_config, parser, args):
5153async def app (pytestconfig , request , aiolib ): # noqa: ARG001
5254 """Load an application, run lifespan events, prepare plugins."""
5355 if not pytestconfig .app :
54- logging .warning (
56+ logging .warning ( # noqa: LOG015
5557 "Improperly configured. Please set ``muffin_app`` in your pytest config. "
5658 "Or use ``--muffin-app`` command option." ,
5759 )
5860 return
5961
60- from muffin .utils import import_app
61-
6262 muffin_app = import_app (pytestconfig .app )
6363 msg = f"Setup application '{ muffin_app .cfg .name } '"
6464 if muffin_app .cfg .config :
@@ -89,7 +89,7 @@ async def lifecycle(app: Application):
8989 yield app
9090
9191
92- @pytest .fixture ()
92+ @pytest .fixture
9393def client (app ):
9494 """Generate a test client for the app."""
9595 return ASGITestClient (app )
0 commit comments