From 3d390940d1ad895527486ea69fd06d68732b677b Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Thu, 6 Feb 2020 00:00:02 +0100 Subject: [PATCH] refer the node-from-parent deprecation documentation in the warning fixup: fix test for warning --- src/_pytest/deprecated.py | 5 ++++- testing/deprecated_test.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index db43c6ca3..cd9ed97d8 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -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( diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index b5c66d9f5..98c535aed 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -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