Skip to content

Commit

Permalink
fix lockfile with test command (#9089)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Jun 14, 2021
1 parent 89b7d5d commit 5cbb6fe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions conans/model/graph_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ def check_locked_build_requires(self, node, package_build_requires, profile_buil
if self._relaxed:
return
locked_node = node.graph_lock_node
if locked_node is None:
return
locked_requires = locked_node.build_requires
if not locked_requires:
return
Expand Down
18 changes: 18 additions & 0 deletions conans/test/integration/graph_lock/graph_lock_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,3 +539,21 @@ def set_version(self):
client.run("lock create conanfile.py --lockfile-out=conan.lock")
client.run("install . --lockfile=conan.lock")
self.assertIn("conanfile.py (pkg/0.1): Installing package", client.out)


def test_error_test_command():
# https://github.com/conan-io/conan/issues/9088
client = TestClient()
client.save({"dep/conanfile.py": GenConanfile(),
"pkg/conanfile.py": GenConanfile().with_requires("dep/[>=1.0]"),
"test_package/conanfile.py": GenConanfile().with_test("pass")})
client.run("create dep dep/1.0@")
client.run("create pkg pkg/1.0@")
client.run("lock create --ref=pkg/1.0@")
client.run("create dep dep/1.1@")
client.run("test test_package pkg/1.0@ --lockfile=conan.lock")
assert "dep/1.0" in client.out
assert "dep/1.1" not in client.out
client.run("test test_package pkg/1.0@")
assert "dep/1.0" not in client.out
assert "dep/1.1" in client.out

0 comments on commit 5cbb6fe

Please sign in to comment.