Skip to content

hook specs are not set for other plugin hooks #1062

@bubenkoff

Description

@bubenkoff

In pytest-bdd we have custom hooks, and they are regstered via:

def pytest_addhooks(pluginmanager):
    """Register plugin hooks."""
    pluginmanager.add_hookspecs(hooks)

this works fine for non-xdist runs
but with xdist we get this:

pytest_bdd/scenario.py:151: in _execute_scenario
    scenario=scenario,
.env/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py:727: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
.env/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py:339: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

hook = <_HookCaller 'pytest_bdd_before_scenario'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7efccaa97f38>]
kwargs = {'feature': <pytest_bdd.feature.Feature object at 0x7efcca995c50>, 'request': <FixtureRequest for <Function 'test_steps'>>, 'scenario': <pytest_bdd.feature.Scenario object at 0x7efcca927310>}

    self._inner_hookexec = lambda hook, methods, kwargs: \
>       _MultiCall(methods, kwargs, hook.spec_opts).execute()
E   AttributeError: '_HookCaller' object has no attribute 'spec_opts'

hook       = <_HookCaller 'pytest_bdd_before_scenario'>
kwargs     = {'feature': <pytest_bdd.feature.Feature object at 0x7efcca995c50>, 'request': <FixtureRequest for <Function 'test_steps'>>, 'scenario': <pytest_bdd.feature.Scenario object at 0x7efcca927310>}
methods    = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7efccaa97f38>]

so looks like hook specs are not parsed and set when xdist's remote run happens

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: xdistrelated to the xdist external plugin

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions