Skip to content

Testing improvements #2417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Disable testing plugin options if dash[testing] not installed.
  • Loading branch information
T4rk1n committed Feb 8, 2023
commit e48674a8ae8faec679f7c1ea7875f4d918eed17f
9 changes: 9 additions & 0 deletions dash/testing/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(self, **kwargs):
)
from dash.testing.browser import Browser
from dash.testing.composite import DashComposite, DashRComposite, DashJuliaComposite
_installed = True
except ImportError:
# Running pytest without dash[testing] installed.
ThreadedRunner = MissingDashTesting
Expand All @@ -33,9 +34,13 @@ def __init__(self, **kwargs):
DashComposite = MissingDashTesting
DashRComposite = MissingDashTesting
DashJuliaComposite = MissingDashTesting
_installed = False


def pytest_addoption(parser):
if not _installed:
return

dash = parser.getgroup("Dash", "Dash Integration Tests")

dash.addoption(
Expand Down Expand Up @@ -82,6 +87,8 @@ def pytest_addoption(parser):

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

@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call): # pylint: disable=unused-argument
if not _installed:
return
# execute all other hooks to obtain the report object
outcome = yield
rep = outcome.get_result()
Expand Down