Skip to content
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

Improve error message when using fixtures but testing not installed. #2187

Merged
merged 4 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
### Fixed

- [#2152](https://github.com/plotly/dash/pull/2152) Fix bug [#2128](https://github.com/plotly/dash/issues/2128) preventing rendering of multiple components inside a dictionary.
- [#2187](https://github.com/plotly/dash/pull/2187) Fix confusing error message when trying to use pytest fixtures but `dash[testing]` is not installed.

## [2.6.1] - 2022-08-01

Expand Down
29 changes: 18 additions & 11 deletions dash/testing/plugin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# pylint: disable=missing-docstring,redefined-outer-name
from typing import Any

import pytest
from .consts import SELENIUM_GRID_DEFAULT


# pylint: disable=too-few-public-methods
class MissingDashTesting:
def __init__(self, **kwargs):
raise Exception(
"dash[testing] was not installed. "
"Please install to use the dash testing fixtures."
)


try:
from dash.testing.application_runners import (
ThreadedRunner,
Expand All @@ -17,15 +24,15 @@
from dash.testing.composite import DashComposite, DashRComposite, DashJuliaComposite
except ImportError:
# Running pytest without dash[testing] installed.
ThreadedRunner = Any
ProcessRunner = Any
MultiProcessRunner = Any
RRunner = Any
JuliaRunner = Any
Browser = Any
DashComposite = Any
DashRComposite = Any
DashJuliaComposite = Any
ThreadedRunner = MissingDashTesting
ProcessRunner = MissingDashTesting
MultiProcessRunner = MissingDashTesting
RRunner = MissingDashTesting
JuliaRunner = MissingDashTesting
Browser = MissingDashTesting
DashComposite = MissingDashTesting
DashRComposite = MissingDashTesting
DashJuliaComposite = MissingDashTesting


def pytest_addoption(parser):
Expand Down