Skip to content

Yield test deprecation warning spams too much #2562

@pv

Description

@pv

While working on scipy/scipy#7572 I noticed that pytest emits the "yield tests are deprecated, and scheduled to be removed in pytest 4.0" warning for each generated test, not per each test generator. (And for scipy, this means the message is printed 15652 times :) -- of course we'll eventually plan to refactor them completely away, but that takes some time.)

There are workarounds such as --disable-warnings and tagging | uniq to the end, but it would be nice if this was fixed to be less spammy on the pytest end.

As far as I understand, there's no way to disable this deprecation warning in pytest.ini without also disabling the whole warning capture mechanism (which is what --disable-pytest-warnings et al seem to do)?

Minimal repro:

# python -mpytest test_foo.py
def test_foo():
    for k in range(10000):
        yield lambda x: None, k
``` plat: Linux $ python --version Python 2.7.13 $ pip list pip (9.0.1) py (1.4.34) pytest (3.1.3) setuptools (36.0.1) wheel (0.29.0) ```

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: warningsrelated to the warnings builtin plugintopic: reportingrelated to terminal output and user-facing messages and errors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions