refer the node-from-parent deprecation documentation in the warning

fixup: fix test for warning
This commit is contained in:
Ronny Pfannschmidt 2020-02-06 00:00:02 +01:00
parent 5fc80d8bc3
commit 3d390940d1
2 changed files with 5 additions and 2 deletions

View File

@ -36,7 +36,10 @@ FIXTURE_POSITIONAL_ARGUMENTS = PytestDeprecationWarning(
NODE_USE_FROM_PARENT = UnformattedWarning(
PytestDeprecationWarning,
"direct construction of {name} has been deprecated, please use {name}.from_parent",
"Direct construction of {name} has been deprecated, please use {name}.from_parent.\n"
"See "
"https://docs.pytest.org/en/latest/deprecations.html#node-construction-changed-to-node-from-parent"
" for more details.",
)
JUNIT_XML_DEFAULT_FAMILY = PytestDeprecationWarning(

View File

@ -86,7 +86,7 @@ def test_node_direct_ctor_warning():
ms = MockConfig()
with pytest.warns(
DeprecationWarning,
match="direct construction of .* has been deprecated, please use .*.from_parent",
match="Direct construction of .* has been deprecated, please use .*.from_parent.*",
) as w:
nodes.Node(name="test", config=ms, session=ms, nodeid="None")
assert w[0].lineno == inspect.currentframe().f_lineno - 1