conan: [bug] conan test fails when using lockfiles
The test_package tests fail for both conan create
or conan test
commands when using lockfiles.
Environment Details (include every applicable attribute)
- Conan version: 1.46.0
- Python version: 3.7.9
Steps to reproduce (Include if Applicable)
conan lock create conanfile.py --profile:host default --profile:build default --lockfile-out locks/conan.lock
conan create conanfile.py --lockfile locks/conan.lock
Logs (Executed commands with output) (Include/Attach if Applicable)
<install and build succeeds>
...
Executing test_package liba/0.1
Configuration (profile_host):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=7
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=7
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
ERROR: Something failed while testing 'liba/0.1' test_package after it was built using the lockfile. Please report this error: 'liba'
Error: Process completed with exit code 1.
More detailed log from cd test_package && conan test . liba/0.1 --lockfile=../locks/conan.lock
(also tried with reference liba/0.1@_/_
):
Using lockfile: 'C:\Projects\conan-demo\conan-demo-liba\conan.lock'
Configuration (profile_host):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=7
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=7
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
Traceback (most recent call last):
File "c:\users\gjess\appdata\local\programs\python\python37\lib\site-packages\conans\client\command.py", line 2238, in run
method(args[0][1:])
File "c:\users\gjess\appdata\local\programs\python\python37\lib\site-packages\conans\client\command.py", line 311, in test
lockfile=args.lockfile, profile_build=profile_build)
File "c:\users\gjess\appdata\local\programs\python\python37\lib\site-packages\conans\client\conan_api.py", line 93, in wrapper
return f(api, *args, **kwargs)
File "c:\users\gjess\appdata\local\programs\python\python37\lib\site-packages\conans\client\conan_api.py", line 334, in test
test_build_folder=test_build_folder, recorder=recorder)
File "c:\users\gjess\appdata\local\programs\python\python37\lib\site-packages\conans\client\cmd\test.py", line 51, in install_build_and_test
test=True # To keep legacy test_package_layout
File "c:\users\gjess\appdata\local\programs\python\python37\lib\site-packages\conans\client\manager.py", line 62, in deps_install
require_overrides=require_overrides)
File "c:\users\gjess\appdata\local\programs\python\python37\lib\site-packages\conans\client\graph\graph_manager.py", line 124, in load_graph
require_overrides)
File "c:\users\gjess\appdata\local\programs\python\python37\lib\site-packages\conans\client\graph\graph_manager.py", line 164, in _load_root_node
require_overrides)
File "c:\users\gjess\appdata\local\programs\python\python37\lib\site-packages\conans\client\graph\graph_manager.py", line 281, in _load_root_test_package
graph_lock.find_require_and_lock(create_reference, conanfile)
File "c:\users\gjess\appdata\local\programs\python\python37\lib\site-packages\conans\model\graph_lock.py", line 664, in find_require_and_lock
conanfile.requires[reference.name].lock(locked_ref, node_id)
KeyError: 'liba'
ERROR: 'liba'
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (2 by maintainers)
Hi @franramirez688,
thanks for your investigation. It’s a shame, but therefore we’re much more looking forward to 2.x. Thanks for the great work the Conan team is doing so far.
@edwardvandevorst-philips Not sure if I understand you correctly but if you leave out the “–lockfile locks/conan.lock” part in that call the prior effort to “conan lock create” makes no sense to me. It is essential to have this here. Idea is to create a package with a lockfile to keep the same dependencies (e.g. in CI) and/or creating buildinfo to scan for vulnerabilities, imho. So, “conan create” will of course run in this case (unless there are no other issues).