diff --git a/CHANGELOG.md b/CHANGELOG.md index 41c01cd93a..54bb6d4df9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/dash/testing/plugin.py b/dash/testing/plugin.py index f9b5d8d716..885ea18a06 100644 --- a/dash/testing/plugin.py +++ b/dash/testing/plugin.py @@ -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, @@ -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):