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

pytest plugin should not be registered by default #946

Closed
vfilimonov opened this issue Sep 29, 2019 · 6 comments · Fixed by #2417
Closed

pytest plugin should not be registered by default #946

vfilimonov opened this issue Sep 29, 2019 · 6 comments · Fixed by #2417
Assignees

Comments

@vfilimonov
Copy link

vfilimonov commented Sep 29, 2019

Hello

I suggest that the pytest plugin should not be registered by default on dash installation.

A clean install of pytest without any plugins automatically activates dash-1.3.1 plugin (which increases the time of test suite by unnecessary import of the module and also annoys with the warning).

On a clean virtual environment:

$ python3 -m venv venv
$ source venv/bin/activate
$ pip install dash
$ pip install pytest
$ mkdir tests
$ cd tests/

an empty run of pytest results in

$ pytest
/Users/user/tmp/venv/lib/python3.7/site-packages/dash/testing/plugin.py:17: UserWarning:

run `pip install dash[testing]` if you need dash.testing

===================================================================== test session starts ======================================================================
platform darwin -- Python 3.7.1, pytest-5.2.0, py-1.8.0, pluggy-0.13.0
rootdir: /Users/user/tmp/tests
plugins: dash-1.3.1
collected 0 items                                                                                                                                              

==================================================================== no tests ran in 0.00s =====================================================================

Though the pytest-dash plugin was never installed:

$ pip uninstall pytest-dash
WARNING: Skipping pytest-dash as it is not installed.
@alexcjohnson
Copy link
Collaborator

Good point @vfilimonov - thanks for bringing it up, I think you're right that we only want the pytest plugin installed with dash[testing].

Unfortunately the solution isn't so clear to me. pytest-dash isn't used anymore, dash.testing is part of the main dash package now. So the pytest plugin is registered in the setup.py for dash itself, and it's not obvious to me how to supply entry points based on requested extras. This question was asked https://stackoverflow.com/questions/36005886/conditional-setuptools-entry-points, with no simple solutions given. Maybe @byronz will have some ideas when he's back from vacation?

@nylocx
Copy link

nylocx commented Nov 15, 2019

Hi,
any news on that or at least way to disable the warning?

@byronz
Copy link
Contributor

byronz commented Nov 15, 2019

@nylocx @vfilimonov I will take a look at the issue, and find out a way for that. sorry for the delay, this was not on my radar before.

@gatesn
Copy link

gatesn commented Jan 22, 2021

Could we move all imports in dash/testing/plugin.py inside the fixtures themselves? This might delay the bulk of the imports until the fixtures are actually invoked.

@jlf-incom
Copy link

Any updates on this issue? We have a monorepo where dash is a dependency and we need to add some seleniumbase tests, but they have a conflict argument (--headless) that prevent us to do that. We are not using the plugin in dash[testing].

@radusuciu
Copy link

radusuciu commented Feb 8, 2023

Any updates on this issue? We have a monorepo where dash is a dependency and we need to add some seleniumbase tests, but they have a conflict argument (--headless) that prevent us to do that. We are not using the plugin in dash[testing].

I have the same issue and just work around it like this:

sed -i 's/--headless/--headless_/g' /venv/lib/python3.9/site-packages/dash/testing/plugin.py

(called during container build time).

Alternatively, you can add -pno:dash as an argument when running pytest to disable the plugin altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants