We upgraded one of our projects to PyTest 4.0.0, and our builds started failing with this deprecation error. We're filtering out the warning for now to get our build running, because there's nothing we can do about it. The warning isn't coming from our code. As you can see from the stacktrace below, the warning is coming from PyTest code.
self = <CallInfo when='collect' exception: usage of Generator.Function is deprecated, please use pytest.Function instead>
func = <function <lambda> at 0x7fa771266d70>, when = 'collect'
treat_keyboard_interrupt_as_exception = False
def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../venv/lib/python2.7/site-packages/_pytest/runner.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../venv/lib/python2.7/site-packages/_pytest/runner.py:272: in <lambda>
call = CallInfo(lambda: list(collector.collect()), "collect")
../venv/lib/python2.7/site-packages/_pytest/python.py:769: in collect
function_class = self.Function
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = _CompatProperty(name='Function')
obj = <Generator 'test_parse_valid_tokens'>
owner = <class '_pytest.python.Generator'>
def __get__(self, obj, owner):
if obj is None:
return self
from _pytest.deprecated import COMPAT_PROPERTY
warnings.warn(
> COMPAT_PROPERTY.format(name=self.name, owner=owner.__name__), stacklevel=2
)
E RemovedInPytest4Warning: usage of Generator.Function is deprecated, please use pytest.Function instead
../venv/lib/python2.7/site-packages/_pytest/nodes.py:70: RemovedInPytest4Warning
Information from the test startup:
============================= test session starts ==============================
platform linux2 -- Python 2.7.12, pytest-4.0.0, py-1.7.0, pluggy-0.8.0
django settings: xxxxxxxxxxxx (from ini file)
rootdir: xxxxxxxxxxxxxxx, inifile: setup.cfg
plugins: django-2.9.1, forked-0.2, pysoa-0.55.0, mock-1.10.0, cov-2.6.0, xdist-1.24.1
Here's a quick checklist in what to include:
We upgraded one of our projects to PyTest 4.0.0, and our builds started failing with this deprecation error. We're filtering out the warning for now to get our build running, because there's nothing we can do about it. The warning isn't coming from our code. As you can see from the stacktrace below, the warning is coming from PyTest code.
Information from the test startup:
Here's a quick checklist in what to include:
pip listof the virtual environment you are using (I've shared what I can without divulging confidential information)