conan icon indicating copy to clipboard operation
conan copied to clipboard

Add failing test for #11763

Open czoido opened this issue 1 year ago • 5 comments

Testing: https://github.com/conan-io/conan/issues/11763

czoido avatar Aug 11 '22 07:08 czoido

Alternatives I can think of:

  • For lock create ., construct the graph from the test_package/conanfile.py, exactly the same as conan create does. This is a bit assymetric with respect to other "local" commands as conan graph, conan build, conan install that will take the package conanfile.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 the test_package/conanfile.py, so it doesn't fail when it cannot lock its tool_requires because they are not in the lockfile.

memsharded avatar Aug 11 '22 09:08 memsharded

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.

memsharded avatar Aug 21 '22 22:08 memsharded

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?

memsharded avatar Aug 21 '22 23:08 memsharded

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?

For me explicitly locking the test_package would be good enough 👍

czoido avatar Aug 22 '22 11:08 czoido

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

memsharded avatar Sep 09 '22 11:09 memsharded