Skip to content

Commit 0a7b948

Browse files
update doc examples **untested**
1 parent 36d174c commit 0a7b948

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

doc/en/deprecations.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ Below is a complete list of all pytest features which are considered deprecated.
1919
:class:`_pytest.warning_types.PytestWarning` or subclasses, which can be filtered using
2020
:ref:`standard warning filters <warnings>`.
2121

22+
23+
Node Construction changed to ``Node.from_parent``
24+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25+
26+
.. deprecated:: 5.3
27+
28+
The construction of nodes new should use the named constructor ``from_parent``.
29+
This limitation in api surface intends to enable better/simpler refactoring of the collection tree.
30+
31+
2232
``junit_family`` default value change to "xunit2"
2333
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2434

doc/en/example/nonpython/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
def pytest_collect_file(parent, path):
66
if path.ext == ".yaml" and path.basename.startswith("test"):
7-
return YamlFile(path, parent)
7+
return YamlFile.from_parent(parent, fspath=path)
88

99

1010
class YamlFile(pytest.File):
@@ -13,7 +13,7 @@ def collect(self):
1313

1414
raw = yaml.safe_load(self.fspath.open())
1515
for name, spec in sorted(raw.items()):
16-
yield YamlItem(name, self, spec)
16+
yield YamlItem.from_parent(self, name=name, spec=spec)
1717

1818

1919
class YamlItem(pytest.Item):

doc/en/example/py2py3/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ def collect(self):
1313
def pytest_pycollect_makemodule(path, parent):
1414
bn = path.basename
1515
if "py3" in bn and not py3 or ("py2" in bn and py3):
16-
return DummyCollector(path, parent=parent)
16+
return DummyCollector.from_parent(parent, fspath=path)

0 commit comments

Comments
 (0)