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