conan
conan copied to clipboard
Add failing test for #11763
Testing: https://github.com/conan-io/conan/issues/11763
Alternatives I can think of:
- For
lock create .
, construct the graph from thetest_package/conanfile.py
, exactly the same asconan create
does. This is a bit assymetric with respect to other "local" commands asconan graph
,conan build
,conan install
that will take the packageconanfile.py
as root of the graph, not the test_package one. This approach will effectively lock the test_package "build_requires" in the lockfile, something that I have seen also requested and users struggling in 1.X - Capture the lockfile as it is doing now, without locking the
test_package/conanfile.py
and relax the "strict" attribute for thetest_package/conanfile.py
, so it doesn't fail when it cannot lock itstool_requires
because they are not in the lockfile.
Update: The 1st approach has a challenge: to load the test_package/conanfile.py
it is necessary to know the ref
of the package. This is known at conan create
time because it is exported first into the cache, and its reference is computed. Without exporting it, it becomes very complicated to obtain the reference. It might also have some other complexities, like locking the self version.
I have submitted a potential solution: make explicit the locking of test_package. Basically the line:
c.run("lock create test_package --lockfile=conan.lock --lockfile-out=conan.lock")
Note this is done after capturing the main lockfile, and it will append its tool_requires
to the initial lockfile. The self.tested_reference_str
is None in this case, the graph is not fully expanded, only the new requires declared by test_package/conanfile.py
.
Wdyt?
I have submitted a potential solution: make explicit the locking of test_package. Basically the line:
c.run("lock create test_package --lockfile=conan.lock --lockfile-out=conan.lock")
Note this is done after capturing the main lockfile, and it will append its
tool_requires
to the initial lockfile. Theself.tested_reference_str
is None in this case, the graph is not fully expanded, only the new requires declared bytest_package/conanfile.py
.Wdyt?
For me explicitly locking the test_package would be good enough 👍
The workaround explicitly locking test_package
seems to be good atm.
We probably want to revisit this after https://github.com/conan-io/conan/pull/12046, moving this to beta.4