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

fix lockfile with test command #9089

Merged
merged 1 commit into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

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