2017-10-30 23:44:49 +08:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
from _pytest.python import PyCollector
|
|
|
|
|
|
|
|
|
|
|
|
class PyCollectorMock(PyCollector):
|
|
|
|
"""evil hack"""
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
self.called = False
|
|
|
|
|
|
|
|
def _makeitem(self, *k):
|
|
|
|
"""hack to disable the actual behaviour"""
|
|
|
|
self.called = True
|
|
|
|
|
|
|
|
|
|
|
|
def test_pycollector_makeitem_is_deprecated():
|
|
|
|
|
|
|
|
collector = PyCollectorMock()
|
|
|
|
with pytest.deprecated_call():
|
2018-05-23 22:48:46 +08:00
|
|
|
collector.makeitem("foo", "bar")
|
2017-10-30 23:44:49 +08:00
|
|
|
assert collector.called
|