Skip to content

Commit 5ecfa7b

Browse files
committed
Use lock instead of sleep for testing running.
1 parent 4822b7b commit 5ecfa7b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/integration/callbacks/test_basic_callback.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ def on_click(_):
794794

795795

796796
def test_cbsc019_callback_running(dash_duo):
797+
lock = Lock()
797798
app = Dash(__name__)
798799

799800
app.layout = html.Div(
@@ -811,11 +812,14 @@ def test_cbsc019_callback_running(dash_duo):
811812
prevent_initial_call=True,
812813
)
813814
def on_click(_):
814-
time.sleep(1.0)
815+
with lock:
816+
pass
815817
return "done"
816818

817819
dash_duo.start_server(app)
818-
dash_duo.find_element("#start").click()
819-
dash_duo.wait_for_text_to_equal("#running", "on")
820+
with lock:
821+
dash_duo.find_element("#start").click()
822+
dash_duo.wait_for_text_to_equal("#running", "on")
823+
820824
dash_duo.wait_for_text_to_equal("#output", "done")
821825
dash_duo.wait_for_text_to_equal("#running", "off")

0 commit comments

Comments
 (0)