File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -585,3 +585,11 @@ def test_custom_loop__not_importable_custom_loop_setup_function(caplog: pytest.L
585585 'Error loading custom loop setup function. Attribute "non_existing_setup_function" not found in module "tests.test_config".' # noqa: E501
586586 == error_messages .pop (0 )
587587 )
588+
589+
590+ def test_setup_event_loop_is_removed (caplog : pytest .LogCaptureFixture ) -> None :
591+ config = Config (app = asgi_app )
592+ with pytest .raises (
593+ AttributeError , match = "The `setup_event_loop` method was replaced by `get_loop_factory` in uvicorn 0.36.0."
594+ ):
595+ config .setup_event_loop ()
Original file line number Diff line number Diff line change @@ -473,9 +473,16 @@ def load(self) -> None:
473473
474474 self .loaded = True
475475
476+ def setup_event_loop (self ) -> None :
477+ raise AttributeError (
478+ "The `setup_event_loop` method was replaced by `get_loop_factory` in uvicorn 0.36.0.\n "
479+ "None of those methods are supposed to be used directly. If you are doing it, please let me know here: "
480+ "https://github.com/Kludex/uvicorn/discussions/2706. Thank you, and sorry for the inconvenience."
481+ )
482+
476483 def get_loop_factory (self ) -> Callable [[], asyncio .AbstractEventLoop ] | None :
477484 if self .loop in LOOP_FACTORIES :
478- loop_factory : Callable | None = import_from_string (LOOP_FACTORIES [self .loop ])
485+ loop_factory : Callable [..., Any ] | None = import_from_string (LOOP_FACTORIES [self .loop ])
479486 else :
480487 try :
481488 return import_from_string (self .loop )
You can’t perform that action at this time.
0 commit comments