Skip to content

Commit

Permalink
python_requires test_package (#3537)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded authored Jan 29, 2024
1 parent 5d136dc commit 43f5e48
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions reference/extensions/python_requires.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit 43f5e48

Please sign in to comment.