Skip to content

Commit 3a0287b

Browse files
committed
Move test client inline restarts to own file
1 parent 2538532 commit 3a0287b

File tree

2 files changed

+52
-51
lines changed

2 files changed

+52
-51
lines changed

tests/integration/clientside/test_clientside.py

-51
Original file line numberDiff line numberDiff line change
@@ -829,54 +829,3 @@ def test_clsd019_clientside_inline_promise(dash_duo):
829829

830830
dash_duo.start_server(app)
831831
dash_duo.wait_for_text_to_equal("#output-div", "initial-inline")
832-
833-
834-
def test_clsd020_clientside_inline_restarts(dash_duo_mp):
835-
reloads = 0
836-
837-
def create_app():
838-
nonlocal reloads
839-
840-
app = Dash(__name__)
841-
842-
app.layout = html.Div([
843-
html.Button("Click", id="click"),
844-
html.Div(id="output"),
845-
html.Div(reloads, id="reload")
846-
])
847-
848-
app.clientside_callback(
849-
"(n_clicks) => `clicked ${n_clicks}`",
850-
Output("output", "children"),
851-
Input("click", "n_clicks"),
852-
prevent_initial_call=True
853-
)
854-
reloads += 1
855-
return app
856-
857-
hot_reload_settings = dict(
858-
dev_tools_hot_reload=True,
859-
dev_tools_ui=True,
860-
dev_tools_serve_dev_bundles=True,
861-
dev_tools_hot_reload_interval=0.1,
862-
dev_tools_hot_reload_max_retry=100,
863-
)
864-
865-
dash_duo_mp.start_server(
866-
create_app(),
867-
**hot_reload_settings
868-
)
869-
dash_duo_mp.find_element("#click").click()
870-
dash_duo_mp.wait_for_text_to_equal("#output", "clicked 1")
871-
872-
dash_duo_mp.server.stop()
873-
874-
dash_duo_mp.start_server(
875-
create_app(),
876-
navigate=False,
877-
**hot_reload_settings
878-
)
879-
dash_duo_mp.wait_for_text_to_equal("#reload", "1")
880-
dash_duo_mp.find_element("#click").click()
881-
# reloaded so 1 again.
882-
dash_duo_mp.wait_for_text_to_equal("#output", "clicked 1")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
from dash import Dash, html, Output, Input
2+
3+
4+
def test_clrs001_clientside_inline_restarts(dash_duo_mp):
5+
reloads = 0
6+
7+
def create_app():
8+
nonlocal reloads
9+
10+
app = Dash(__name__)
11+
12+
app.layout = html.Div([
13+
html.Button("Click", id="click"),
14+
html.Div(id="output"),
15+
html.Div(reloads, id="reload")
16+
])
17+
18+
app.clientside_callback(
19+
"(n_clicks) => `clicked ${n_clicks}`",
20+
Output("output", "children"),
21+
Input("click", "n_clicks"),
22+
prevent_initial_call=True
23+
)
24+
reloads += 1
25+
return app
26+
27+
hot_reload_settings = dict(
28+
dev_tools_hot_reload=True,
29+
dev_tools_ui=True,
30+
dev_tools_serve_dev_bundles=True,
31+
dev_tools_hot_reload_interval=0.1,
32+
dev_tools_hot_reload_max_retry=100,
33+
)
34+
35+
dash_duo_mp.start_server(
36+
create_app(),
37+
**hot_reload_settings
38+
)
39+
dash_duo_mp.find_element("#click").click()
40+
dash_duo_mp.wait_for_text_to_equal("#output", "clicked 1")
41+
42+
dash_duo_mp.server.stop()
43+
44+
dash_duo_mp.start_server(
45+
create_app(),
46+
navigate=False,
47+
**hot_reload_settings
48+
)
49+
dash_duo_mp.wait_for_text_to_equal("#reload", "1")
50+
dash_duo_mp.find_element("#click").click()
51+
# reloaded so 1 again.
52+
dash_duo_mp.wait_for_text_to_equal("#output", "clicked 1")

0 commit comments

Comments
 (0)