@@ -22,6 +22,7 @@ def __init__(self, **kwargs):
22
22
)
23
23
from dash .testing .browser import Browser
24
24
from dash .testing .composite import DashComposite , DashRComposite , DashJuliaComposite
25
+ _installed = True
25
26
except ImportError :
26
27
# Running pytest without dash[testing] installed.
27
28
ThreadedRunner = MissingDashTesting
@@ -33,9 +34,13 @@ def __init__(self, **kwargs):
33
34
DashComposite = MissingDashTesting
34
35
DashRComposite = MissingDashTesting
35
36
DashJuliaComposite = MissingDashTesting
37
+ _installed = False
36
38
37
39
38
40
def pytest_addoption (parser ):
41
+ if not _installed :
42
+ return
43
+
39
44
dash = parser .getgroup ("Dash" , "Dash Integration Tests" )
40
45
41
46
dash .addoption (
@@ -82,6 +87,8 @@ def pytest_addoption(parser):
82
87
83
88
@pytest .mark .tryfirst
84
89
def pytest_addhooks (pluginmanager ):
90
+ if not _installed :
91
+ return
85
92
# https://github.com/pytest-dev/pytest-xdist/blob/974bd566c599dc6a9ea291838c6f226197208b46/xdist/plugin.py#L67
86
93
# avoid warnings with pytest-2.8
87
94
from dash .testing import newhooks # pylint: disable=import-outside-toplevel
@@ -94,6 +101,8 @@ def pytest_addhooks(pluginmanager):
94
101
95
102
@pytest .hookimpl (tryfirst = True , hookwrapper = True )
96
103
def pytest_runtest_makereport (item , call ): # pylint: disable=unused-argument
104
+ if not _installed :
105
+ return
97
106
# execute all other hooks to obtain the report object
98
107
outcome = yield
99
108
rep = outcome .get_result ()
0 commit comments