Skip to content

Commit 443f785

Browse files
committed
removing test_async from the utils to keep from confusing pytest
1 parent 28b0693 commit 443f785

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

tests/integration/async_tests/test_async_background_callbacks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
from multiprocessing import Lock
66
from tests.integration.async_tests.utils import setup_background_callback_app
77
import time
8-
from tests.utils import test_async
8+
from tests.utils import is_dash_async
99

1010

1111
def test_001ab_arbitrary(dash_duo, manager):
12-
if not test_async():
12+
if not is_dash_async():
1313
return
1414
with setup_background_callback_app(manager, "app_arbitrary_async") as app:
1515
dash_duo.start_server(app)
@@ -41,7 +41,7 @@ def test_002ab_basic(dash_duo, manager):
4141
"""
4242
Make sure that we settle to the correct final value when handling rapid inputs
4343
"""
44-
if not test_async():
44+
if not is_dash_async():
4545
return
4646
lock = Lock()
4747
with setup_background_callback_app(manager, "app1_async") as app:

tests/integration/async_tests/test_async_callbacks.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
)
2626
from dash.exceptions import PreventUpdate
2727
from tests.integration.utils import json_engine
28-
from tests.utils import test_async
28+
from tests.utils import is_dash_async
2929

3030

3131
def test_async_cbsc001_simple_callback(dash_duo, *args):
32-
if not test_async():
32+
if not is_dash_async():
3333
return
3434
lock = Lock()
3535

@@ -70,7 +70,7 @@ async def update_output(value):
7070

7171
def test_async_cbsc002_callbacks_generating_children(dash_duo, *args):
7272
"""Modify the DOM tree by adding new components in the callbacks."""
73-
if not test_async():
73+
if not is_dash_async():
7474
return
7575
# some components don't exist in the initial render
7676
app = Dash(__name__, suppress_callback_exceptions=True)
@@ -155,7 +155,7 @@ async def update_input(value):
155155

156156

157157
def test_async_cbsc003_callback_with_unloaded_async_component(dash_duo, *args):
158-
if not test_async():
158+
if not is_dash_async():
159159
return
160160
app = Dash()
161161
app.layout = html.Div(
@@ -190,7 +190,7 @@ async def update_out(n_clicks):
190190

191191

192192
def test_async_cbsc004_callback_using_unloaded_async_component(dash_duo, *args):
193-
if not test_async():
193+
if not is_dash_async():
194194
return
195195
app = Dash()
196196
app.layout = html.Div(
@@ -257,7 +257,7 @@ async def update_out2(n_clicks, data):
257257

258258
@pytest.mark.parametrize("engine", ["json", "orjson"])
259259
def test_async_cbsc005_children_types(dash_duo, engine):
260-
if not test_async():
260+
if not is_dash_async():
261261
return
262262
with json_engine(engine):
263263
app = Dash()
@@ -290,7 +290,7 @@ async def set_children(n):
290290

291291
@pytest.mark.parametrize("engine", ["json", "orjson"])
292292
def test_async_cbsc006_array_of_objects(dash_duo, engine):
293-
if not test_async():
293+
if not is_dash_async():
294294
return
295295
with json_engine(engine):
296296
app = Dash()
@@ -335,7 +335,7 @@ def test_async_cbsc007_parallel_updates(refresh, dash_duo, *args):
335335
# pendingCallbacks, calling PreventUpdate in the callback would also skip
336336
# any callbacks that depend on pathname, despite the new front-end-provided
337337
# value.
338-
if not test_async():
338+
if not is_dash_async():
339339
return
340340
app = Dash()
341341

@@ -378,7 +378,7 @@ async def set_path(n):
378378

379379

380380
def test_async_cbsc008_wildcard_prop_callbacks(dash_duo, *args):
381-
if not test_async():
381+
if not is_dash_async():
382382
return
383383
lock = Lock()
384384

@@ -447,7 +447,7 @@ async def update_text(data):
447447
def test_async_cbsc009_callback_using_unloaded_async_component_and_graph(
448448
dash_duo, *args
449449
):
450-
if not test_async():
450+
if not is_dash_async():
451451
return
452452
app = Dash(__name__)
453453
app.layout = FragmentComponent(
@@ -492,7 +492,7 @@ async def content(n, d, v):
492492

493493

494494
def test_async_cbsc010_event_properties(dash_duo, *args):
495-
if not test_async():
495+
if not is_dash_async():
496496
return
497497
app = Dash(__name__)
498498
app.layout = html.Div([html.Button("Click Me", id="button"), html.Div(id="output")])
@@ -516,7 +516,7 @@ async def update_output(n_clicks):
516516

517517

518518
def test_async_cbsc011_one_call_for_multiple_outputs_initial(dash_duo, *args):
519-
if not test_async():
519+
if not is_dash_async():
520520
return
521521
app = Dash(__name__)
522522
call_count = Value("i", 0)
@@ -554,7 +554,7 @@ async def dynamic_output(*args):
554554

555555

556556
def test_async_cbsc012_one_call_for_multiple_outputs_update(dash_duo, *args):
557-
if not test_async():
557+
if not is_dash_async():
558558
return
559559
app = Dash(__name__, suppress_callback_exceptions=True)
560560
call_count = Value("i", 0)
@@ -606,7 +606,7 @@ async def dynamic_output(*args):
606606

607607

608608
def test_async_cbsc013_multi_output_out_of_order(dash_duo, *args):
609-
if not test_async():
609+
if not is_dash_async():
610610
return
611611
app = Dash(__name__)
612612
app.layout = html.Div(
@@ -649,7 +649,7 @@ async def update_output(n_clicks):
649649
def test_async_cbsc014_multiple_properties_update_at_same_time_on_same_component(
650650
dash_duo,
651651
):
652-
if not test_async():
652+
if not is_dash_async():
653653
return
654654
call_count = Value("i", 0)
655655
timestamp_1 = Value("d", -5)
@@ -707,7 +707,7 @@ async def update_output(n1, t1, n2, t2):
707707

708708

709709
def test_async_cbsc015_input_output_callback(dash_duo, *args):
710-
if not test_async():
710+
if not is_dash_async():
711711
return
712712
return
713713
# disabled because this is trying to look at a synchronous lock in an async environment
@@ -760,7 +760,7 @@ def test_async_cbsc015_input_output_callback(dash_duo, *args):
760760

761761

762762
def test_async_cbsc016_extra_components_callback(dash_duo, *args):
763-
if not test_async():
763+
if not is_dash_async():
764764
return
765765
lock = Lock()
766766

@@ -799,7 +799,7 @@ async def update_output(value, data):
799799

800800

801801
def test_async_cbsc017_callback_directly_callable():
802-
if not test_async():
802+
if not is_dash_async():
803803
return
804804
## unneeded
805805
# app = Dash(__name__)
@@ -821,7 +821,7 @@ def test_async_cbsc017_callback_directly_callable():
821821

822822

823823
def test_async_cbsc018_callback_ndarray_output(dash_duo, *args):
824-
if not test_async():
824+
if not is_dash_async():
825825
return
826826
app = Dash(__name__)
827827
app.layout = html.Div([dcc.Store(id="output"), html.Button("click", id="clicker")])
@@ -839,7 +839,7 @@ async def on_click(_):
839839

840840

841841
def test_async_cbsc019_callback_running(dash_duo, *args):
842-
if not test_async():
842+
if not is_dash_async():
843843
return
844844
lock = Lock()
845845
app = Dash(__name__)
@@ -873,7 +873,7 @@ async def on_click(_):
873873

874874

875875
def test_async_cbsc020_callback_running_non_existing_component(dash_duo, *args):
876-
if not test_async():
876+
if not is_dash_async():
877877
return
878878
lock = Lock()
879879
app = Dash(__name__, suppress_callback_exceptions=True)
@@ -910,7 +910,7 @@ async def on_click(_):
910910

911911

912912
def test_async_cbsc021_callback_running_non_existing_component(dash_duo, *args):
913-
if not test_async():
913+
if not is_dash_async():
914914
return
915915
lock = Lock()
916916
app = Dash(__name__)

tests/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def test_async():
1+
def is_dash_async():
22
try:
33

44
import asgiref # pylint: disable=unused-import, # noqa: F401

0 commit comments

Comments
 (0)