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

🔇 remove the warning as it might confuse non dash usage #1015

Merged
merged 9 commits into from
Nov 22, 2019
15 changes: 5 additions & 10 deletions dash/testing/plugin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# pylint: disable=missing-docstring,redefined-outer-name
import warnings
import pytest
from .consts import SELENIUM_GRID_DEFAULT


try:
import pytest

from dash.testing.application_runners import (
ThreadedRunner,
ProcessRunner,
Expand All @@ -14,17 +11,15 @@
from dash.testing.browser import Browser
from dash.testing.composite import DashComposite, DashRComposite
except ImportError:
warnings.warn("run `pip install dash[testing]` if you need dash.testing")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't we also need to put all the below definitions into the try block, so that without the necessary imports it won't try to define our fixtures?

That said, this still doesn't seem like it completely satisfies the request of #946 - this takes care of the "annoys with the warning" part, but not the "increases the time of test suite by unnecessary import of the module" part. As I said in the issue, it's not clear to me how one can resolve that part, but the ideal seems to me determining whether setup.py was called with [testing] or not - and only include "pytest11": ["dash = dash.testing.plugin"] if yes.


WEBDRIVERS = {"Chrome", "Firefox"}
pass


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

dash.addoption(
"--webdriver",
choices=tuple(WEBDRIVERS),
choices=("Chrome", "Firefox"),
default="Chrome",
help="Name of the selenium driver to use",
)
Expand All @@ -51,8 +46,8 @@ def pytest_addoption(parser):
dash.addoption(
"--percy-assets",
action="store",
default='tests/assets',
help="configure how Percy will discover your app's assets"
default="tests/assets",
help="configure how Percy will discover your app's assets",
)

dash.addoption(
Expand Down
24 changes: 16 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import io
import pkgutil
from setuptools import setup, find_packages

ENTRY_POINTS = {
"console_scripts": [
"dash-generate-components = "
"dash.development.component_generator:cli",
"renderer = dash.development.build_process:renderer",
]
}

# this is not a complete guess, but picking two typical dash dependencies in
# require-testing.txt
if pkgutil.find_loader("waitress") and pkgutil.find_loader("percy"):
ENTRY_POINTS["pytest11"] = ["dash = dash.testing.plugin"]
byronz marked this conversation as resolved.
Show resolved Hide resolved

main_ns = {}
exec(open("dash/version.py").read(), main_ns) # pylint: disable=exec-used

Expand All @@ -26,18 +40,12 @@ def read_req_file(req_type):
long_description=io.open("README.md", encoding="utf-8").read(),
long_description_content_type="text/markdown",
install_requires=read_req_file("install"),
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*",
extras_require={
"dev": read_req_file("dev"),
"testing": read_req_file("testing"),
},
entry_points={
"console_scripts": [
"dash-generate-components = "
"dash.development.component_generator:cli",
"renderer = dash.development.build_process:renderer",
],
"pytest11": ["dash = dash.testing.plugin"],
},
entry_points=ENTRY_POINTS,
url="https://plot.ly/dash",
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down