File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed
Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 1111
1212import uvicorn
1313
14- from reactpy .config import REACTPY_TESTS_DEFAULT_TIMEOUT
1514from reactpy .core .component import component
1615from reactpy .core .hooks import use_callback , use_effect , use_state
1716from reactpy .executors .asgi .middleware import ReactPyMiddleware
@@ -47,15 +46,11 @@ def __init__(
4746 app : AsgiApp | None = None ,
4847 host : str = "127.0.0.1" ,
4948 port : int | None = None ,
50- timeout : float | None = None ,
5149 ** reactpy_config : Any ,
5250 ) -> None :
5351 self .host = host
5452 self .port = port or 0
5553 self .mount = mount_to_hotswap
56- self .timeout = (
57- REACTPY_TESTS_DEFAULT_TIMEOUT .current if timeout is None else timeout
58- )
5954 if isinstance (app , (ReactPyMiddleware , ReactPy )):
6055 self ._app = app
6156 elif app :
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ def __init__(
2525 backend : BackendFixture | None = None ,
2626 browser : Browser | None = None ,
2727 headless : bool = False ,
28+ timeout : float | None = None ,
2829 ) -> None :
2930 if backend :
3031 self .backend_is_external = True
@@ -34,6 +35,9 @@ def __init__(
3435 self .browser_is_external = True
3536 self .browser = browser
3637
38+ self .timeout = (
39+ timeout if timeout is not None else REACTPY_TESTS_DEFAULT_TIMEOUT .current
40+ )
3741 self .headless = headless
3842
3943 async def show (
@@ -69,7 +73,7 @@ async def __aenter__(self) -> DisplayFixture:
6973 async def configure_page (self ) -> None :
7074 if getattr (self , "page" , None ) is None :
7175 self .page = await self .browser .new_page ()
72- self .page .set_default_timeout (REACTPY_TESTS_DEFAULT_TIMEOUT . current * 1000 )
76+ self .page .set_default_timeout (self . timeout * 1000 )
7377 self .page .on ("console" , lambda msg : print (f"BROWSER CONSOLE: { msg .text } " )) # noqa: T201
7478 self .page .on ("pageerror" , lambda exc : print (f"BROWSER ERROR: { exc } " )) # noqa: T201
7579
Original file line number Diff line number Diff line change @@ -22,7 +22,9 @@ async def display(browser):
2222 )
2323
2424 async with BackendFixture (app ) as server :
25- async with DisplayFixture (backend = server , browser = browser ) as new_display :
25+ async with DisplayFixture (
26+ backend = server , browser = browser , timeout = 20
27+ ) as new_display :
2628 yield new_display
2729
2830
You can’t perform that action at this time.
0 commit comments