deprecate direct node construction and introduce Node.from_parent
This commit is contained in:
committed by
Ronny Pfannschmidt
parent
886b8d27c6
commit
c99c7d0f95
@@ -281,10 +281,10 @@ class TestFunction:
|
||||
from _pytest.fixtures import FixtureManager
|
||||
|
||||
config = testdir.parseconfigure()
|
||||
session = testdir.Session(config)
|
||||
session = testdir.Session.from_config(config)
|
||||
session._fixturemanager = FixtureManager(session)
|
||||
|
||||
return pytest.Function(config=config, parent=session, **kwargs)
|
||||
return pytest.Function.from_parent(config=config, parent=session, **kwargs)
|
||||
|
||||
def test_function_equality(self, testdir, tmpdir):
|
||||
def func1():
|
||||
@@ -1024,7 +1024,7 @@ class TestReportInfo:
|
||||
return "ABCDE", 42, "custom"
|
||||
def pytest_pycollect_makeitem(collector, name, obj):
|
||||
if name == "test_func":
|
||||
return MyFunction(name, parent=collector)
|
||||
return MyFunction.from_parent(name=name, parent=collector)
|
||||
"""
|
||||
)
|
||||
item = testdir.getitem("def test_func(): pass")
|
||||
|
||||
@@ -10,7 +10,7 @@ class TestOEJSKITSpecials:
|
||||
import pytest
|
||||
def pytest_pycollect_makeitem(collector, name, obj):
|
||||
if name == "MyClass":
|
||||
return MyCollector(name, parent=collector)
|
||||
return MyCollector.from_parent(collector, name=name)
|
||||
class MyCollector(pytest.Collector):
|
||||
def reportinfo(self):
|
||||
return self.fspath, 3, "xyz"
|
||||
@@ -40,7 +40,7 @@ class TestOEJSKITSpecials:
|
||||
import pytest
|
||||
def pytest_pycollect_makeitem(collector, name, obj):
|
||||
if name == "MyClass":
|
||||
return MyCollector(name, parent=collector)
|
||||
return MyCollector.from_parent(collector, name=name)
|
||||
class MyCollector(pytest.Collector):
|
||||
def reportinfo(self):
|
||||
return self.fspath, 3, "xyz"
|
||||
|
||||
@@ -30,7 +30,7 @@ class TestMetafunc:
|
||||
|
||||
names = fixtures.getfuncargnames(func)
|
||||
fixtureinfo = FixtureInfo(names)
|
||||
definition = DefinitionMock(func)
|
||||
definition = DefinitionMock._create(func)
|
||||
return python.Metafunc(definition, fixtureinfo, config)
|
||||
|
||||
def test_no_funcargs(self, testdir):
|
||||
|
||||
Reference in New Issue
Block a user