Skip to content

Deprecate hook parameters #178

@nicoddemus

Description

@nicoddemus

We already have support for deprecating hooks, where a warning is issued if any plugin implements a deprecated hook.

Recently in pytest 3.8 we introduced a new hook, pytest_warning_captured(warning_message, when, item).

Problem is that only later I realized that item is incompatible with xdist (pytest-dev/pytest-xdist#341) because we can't transfer pytest.Item objects between workers and master. 😓

I would like then to deprecate the item parameter by issuing a warning if a hook implementation uses it.

Given our current deprecation support of hook impls:

@hookspec(historic=True, warn_on_impl=DeprecationWarning("pytest_namespace() is deprecated"))
def pytest_namespace():
    ...

I propose:

@hookspec(historic=True, warn_on_param_impl={'item': DeprecationWarning('item deprecated because of reasons'})
def pytest_warning_captured(warning_message, item, when):
    ...

What do you guys think?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions