opened
azmeuk
username_0
Hi. It seems I cannot disable xdist, the following script fails.
```bash
mkdir pytest-xdist-test; cd pytest-xdist-test
virtualenv -p python3 env
./env/bin/pip install pytest pytest-xdist pytest-sugar
echo "def test_false(): assert False" > test_foobar.py
pytest -p no:xdist test_foobar.py
```
```
Test session starts (platform: linux, Python 3.6.1, pytest 3.1.0, pytest-sugar 0.8.0)
rootdir: /home/eloi/pytest-xdist-test, inifile:
plugins: xdist-1.16.0, sugar-0.8.0
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/eloi/pytest-xdist-test/env/lib/python3.6/site-packages/_pytest/main.py", line 105, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/eloi/pytest-xdist-test/env/lib/python3.6/site-packages/_pytest/main.py", line 140, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/home/eloi/pytest-xdist-test/env/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/home/eloi/pytest-xdist-test/env/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/eloi/pytest-xdist-test/env/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/home/eloi/pytest-xdist-test/env/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/eloi/pytest-xdist-test/env/lib/python3.6/site-packages/_pytest/main.py", line 150, in pytest_collection
INTERNALERROR>     return session.perform_collect()
INTERNALERROR>   File "/home/eloi/pytest-xdist-test/env/lib/python3.6/site-packages/_pytest/main.py", line 605, in perform_collect
INTERNALERROR>     self.config.pluginmanager.check_pending()
INTERNALERROR>   File "/home/eloi/pytest-xdist-test/env/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 498, in check_pending
INTERNALERROR>     (name, hookimpl.plugin))
INTERNALERROR> _pytest.vendored_packages.pluggy.PluginValidationError: unknown hook 'pytest_xdist_node_collection_finished' in plugin <module 'pytest_sugar' (<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f45f9176358>)>


Results (0.00s):
```
However `pytest -p no:xdist -p no:sugar test_foobar.py` seems to work.
Cannot disable xdist with -p no:xdist if pytest-sugar is installed
issue
created
RonnyPfannschmidt
username_1
this is a bug in pytest plugin management xdist itself cant do anything about it
the combination happens because of an interactionb etween opting out of a plugin, and requiring the hooks of that plugin

does it happen with pytest 3.0.x ?
comment
created
azmeuk
username_0
No, I am using pytest 3.1.0.
comment
created
RonnyPfannschmidt
username_1
i just checked
the bug is in pytest-sugar - https://github.com/Frozenball/pytest-sugar/blob/master/pytest_sugar.py#L82
comment
created
azmeuk
username_0
With `pip install -U "pytest<3.1.0"` it provokes the following error:
```
Traceback (most recent call last):
  File "./env/bin/pytest", line 11, in <module>
    sys.exit(main())
  File "/home/eloi/pytest-xdist-test/env/lib/python3.6/site-packages/_pytest/config.py", line 56, in main
    config.pluginmanager.check_pending()
  File "/home/eloi/pytest-xdist-test/env/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 498, in check_pending
    (name, hookimpl.plugin))
_pytest.vendored_packages.pluggy.PluginValidationError: unknown hook 'pytest_xdist_node_collection_finished' in plugin <module 'pytest_sugar' (<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f0121788c88>)>
```
comment
created
azmeuk
username_0
Ok, I will post them a bug report then. Thank you!
comment
created
RonnyPfannschmidt
username_1
thanks, closing this one then, please put a reference into the bug you report them

for sanity they should do their checks in a pytest-configure hook and/or declare the hook optional
comment
closed
azmeuk
username_0
issue