Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python_requires test_package #3537

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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