From 2ad1a79ee11ba2d08caea7e00bb61102bd73ac70 Mon Sep 17 00:00:00 2001 From: memsharded Date: Mon, 29 Jan 2024 14:12:52 +0100 Subject: [PATCH] python_requires test_package --- reference/extensions/python_requires.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reference/extensions/python_requires.rst b/reference/extensions/python_requires.rst index 396b171ae945..b86753e93401 100644 --- a/reference/extensions/python_requires.rst +++ b/reference/extensions/python_requires.rst @@ -244,12 +244,19 @@ It is possible to test with ``test_package`` a ``python_require``, by adding a ` from conan import ConanFile class Tool(ConanFile): + + # Literal "tested_reference_str", Conan will dynamically replace it + python_requires = "tested_reference_str" + def test(self): pyreq = self.python_requires["pyreq"].module mynumber = pyreq.mynumber() self.output.info("{}!!!".format(mynumber)) +The ``python_requires = "tested_reference_str"`` is mandatory from Conan 2.1. Automatic injection of ``python_requires`` +without this declaration is deprecated and it will be removed in future versions. + Note that the ``test_package/conanfile.py`` does not need any type of declaration of the ``python_requires``, this is done automatically and implicitly. We can now create and test it with: