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

-p no:pluginname on pytest 2.9.x ignored on xdist slave node #1618

Closed
fizyk opened this issue Jun 18, 2016 · 12 comments
Closed

-p no:pluginname on pytest 2.9.x ignored on xdist slave node #1618

fizyk opened this issue Jun 18, 2016 · 12 comments
Labels
status: critical grave problem or usability issue that affects lots of users topic: reporting related to terminal output and user-facing messages and errors type: backward compatibility might present some backward compatibility issues which should be carefully noted in the changelog type: bug problem that needs to be addressed type: enhancement new feature or API change, should be merged into features branch type: feature-branch new feature or API change, should be merged into features branch type: refactoring internal improvements to the code

Comments

@fizyk
Copy link

fizyk commented Jun 18, 2016

For pytest-dbfxitures plugin we run tests both with pytest-xdist and without to make sure we cover all the possibilities on travis. However, when running on xdist on pytest 2.9.x I get
argparse.ArgumentError: argument --dbfixtures-config: conflicting option string: --dbfixtures-config

to get the full coverage we run tests without the plugin (-p no:bfixtures) and import all pytest's plugins triggers in main conftest. It worked perfectly till the 2.9.x version, where it seems under xdist, the plugin is being loaded even thouth the options states it not to load.

alabaster (0.7.7)
apipkg (1.4)
Babel (2.2.0)
backports.shutil-get-terminal-size (1.0.0)
bumpversion (0.5.3)
coverage (4.1)
coveralls (1.1)
decorator (4.0.10)
docopt (0.6.2)
docutils (0.12)
execnet (1.4.1)
fancycompleter (0.4)
ipython (4.2.0)
ipython-genutils (0.1.0)
Jinja2 (2.8)
MarkupSafe (0.23)
mccabe (0.5.0)
mirakuru (0.7.0)
mock (2.0.0)
mysqlclient (1.3.7)
ordereddict (1.1)
pamqp (1.6.1)
path.py (8.2.1)
pbr (1.8.1)
pdbpp (0.8.3)
pep257 (0.7.0)
pep8 (1.7.0)
pexpect (4.1.0)
pickleshare (0.7.2)
pip (7.1.2)
port-for (0.3.1)
psycopg2 (2.6.1)
ptyprocess (0.5.1)
py (1.4.31)
pyaml (15.8.2)
pyflakes (1.2.3)
Pygments (2.1)
pylama (7.0.9)
pymlconf (0.4.0)
pymongo (3.2.2)
pytest (2.9.2)
pytest-cov (2.2.1)
pytest-dbfixtures (0.13.1)
pytest-xdist (1.14)
pytz (2015.7)
PyYAML (3.11)
rabbitpy (0.27.1)
redis (2.10.5)
requests (2.9.1)
setuptools (23.0.0)
simplegeneric (0.8.1)
six (1.10.0)
snowballstemmer (1.2.1)
Sphinx (1.3.5)
sphinx-rtd-theme (0.1.9)
traitlets (4.2.1)
wheel (0.24.0)
wmctrl (0.3)

py.test 2.9.2 and os is anything travis runs its tests on, and ubuntu 16.4
example https://github.com/ClearcodeHQ/pytest-dbfixtures and pull request I;m trying to upgreade the py.test on without sacrificing coverage.

@nicoddemus nicoddemus added type: bug problem that needs to be addressed status: critical grave problem or usability issue that affects lots of users labels Jun 18, 2016
@nicoddemus
Copy link
Member

nicoddemus commented Jun 18, 2016

Thanks for the report!

I would guess the problem is that the option is not being interpreted correctly by the workers, but this needs more investigation.

@RonnyPfannschmidt RonnyPfannschmidt added type: enhancement new feature or API change, should be merged into features branch topic: reporting related to terminal output and user-facing messages and errors good first issue easy issue that is friendly to new contributor and removed type: bug problem that needs to be addressed status: critical grave problem or usability issue that affects lots of users labels Jun 21, 2016
@RonnyPfannschmidt
Copy link
Member

we finished the investigation, your conftest imports the plugin addoption function

so pytest sees an addoption hook in 2 different plugins, thus runs it twice and ends with an conflict

@RonnyPfannschmidt RonnyPfannschmidt changed the title Tests for pytest plugin fails in xdist when trying to run with -p no:plugin on pytest 2.9.x confusing/unhelpful errors when 2 plugin objects contain the same pytest_addoption hook Jun 21, 2016
@RonnyPfannschmidt
Copy link
Member

after re-reading the message, there is probably more to it :)

@RonnyPfannschmidt RonnyPfannschmidt changed the title confusing/unhelpful errors when 2 plugin objects contain the same pytest_addoption hook -p no:pluginname on pytest 2.9.x ignored on xdist slave node Jun 21, 2016
@RonnyPfannschmidt
Copy link
Member

a quick run down of the conditions

  • have a installed python plugin
  • disable it with -p no:my_entry_point
  • reenable it via the conftest, that happens after pytest-cov
  • watch xdist ignore the -p no:my_entry_point

@RonnyPfannschmidt
Copy link
Member

after finishing investigation the issue is enforced by plugin blockers in xdist only being interpreted after initial loading of setuptools plugins,

thus the plugin in dbfixtures gets loaded, then unloaded, but the effects of the addoption stay
the solution will be to fix the behavior of the utility method that is invoked on the remote

@RonnyPfannschmidt RonnyPfannschmidt added type: bug problem that needs to be addressed type: backward compatibility might present some backward compatibility issues which should be carefully noted in the changelog status: critical grave problem or usability issue that affects lots of users type: refactoring internal improvements to the code type: feature-branch new feature or API change, should be merged into features branch and removed good first issue easy issue that is friendly to new contributor labels Jun 25, 2016
@RonnyPfannschmidt
Copy link
Member

0e55a87 was part of it

@RonnyPfannschmidt
Copy link
Member

9c54958 introduced it

RonnyPfannschmidt added a commit to RonnyPfannschmidt/pytest that referenced this issue Jun 25, 2016
additionally prevent unnecessary importation of blocked plugins
RonnyPfannschmidt added a commit to RonnyPfannschmidt/pytest that referenced this issue Jun 25, 2016
additionally prevent unnecessary importation of blocked plugins
RonnyPfannschmidt added a commit to RonnyPfannschmidt/pytest that referenced this issue Jun 25, 2016
@nicoddemus
Copy link
Member

@RonnyPfannschmidt how's the status on this issue?

@nicoddemus
Copy link
Member

Oh #1673 attempts to solve this.

dybi pushed a commit to golemfactory/concent that referenced this issue Sep 7, 2018
…leman_protocol and signing_service

Due to a BUG in pytest: (pytest-dev/pytest#1618) `-p no:django` doesn't work for parallel runs, causing pytest to expect Django setup in non-Django apps and thus failing.
dybi pushed a commit to golemfactory/concent that referenced this issue Sep 10, 2018
…leman_protocol and signing_service

Due to a BUG in pytest: (pytest-dev/pytest#1618) `-p no:django` doesn't work for parallel runs, causing pytest to expect Django setup in non-Django apps and thus failing.
@nicoddemus
Copy link
Member

I believe this has already been fixed with the config changes in pytest-xdist; if not we can reopen this later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: critical grave problem or usability issue that affects lots of users topic: reporting related to terminal output and user-facing messages and errors type: backward compatibility might present some backward compatibility issues which should be carefully noted in the changelog type: bug problem that needs to be addressed type: enhancement new feature or API change, should be merged into features branch type: feature-branch new feature or API change, should be merged into features branch type: refactoring internal improvements to the code
Projects
Development

No branches or pull requests

3 participants