Skip to content

Commit e48674a

Browse files
committed
Disable testing plugin options if dash[testing] not installed.
1 parent 8ffb331 commit e48674a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

dash/testing/plugin.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def __init__(self, **kwargs):
2222
)
2323
from dash.testing.browser import Browser
2424
from dash.testing.composite import DashComposite, DashRComposite, DashJuliaComposite
25+
_installed = True
2526
except ImportError:
2627
# Running pytest without dash[testing] installed.
2728
ThreadedRunner = MissingDashTesting
@@ -33,9 +34,13 @@ def __init__(self, **kwargs):
3334
DashComposite = MissingDashTesting
3435
DashRComposite = MissingDashTesting
3536
DashJuliaComposite = MissingDashTesting
37+
_installed = False
3638

3739

3840
def pytest_addoption(parser):
41+
if not _installed:
42+
return
43+
3944
dash = parser.getgroup("Dash", "Dash Integration Tests")
4045

4146
dash.addoption(
@@ -82,6 +87,8 @@ def pytest_addoption(parser):
8287

8388
@pytest.mark.tryfirst
8489
def pytest_addhooks(pluginmanager):
90+
if not _installed:
91+
return
8592
# https://github.com/pytest-dev/pytest-xdist/blob/974bd566c599dc6a9ea291838c6f226197208b46/xdist/plugin.py#L67
8693
# avoid warnings with pytest-2.8
8794
from dash.testing import newhooks # pylint: disable=import-outside-toplevel
@@ -94,6 +101,8 @@ def pytest_addhooks(pluginmanager):
94101

95102
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
96103
def pytest_runtest_makereport(item, call): # pylint: disable=unused-argument
104+
if not _installed:
105+
return
97106
# execute all other hooks to obtain the report object
98107
outcome = yield
99108
rep = outcome.get_result()

0 commit comments

Comments
 (0)