Skip to content

Commit 9eb72c8

Browse files
authored
lock upgrade: add more tests (#17845)
Added a test for lock upgrade
1 parent 9bf7442 commit 9eb72c8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/integration/lockfile/test_user_overrides.py

+22
Original file line numberDiff line numberDiff line change
@@ -435,3 +435,25 @@ def test_lock_upgrade_path(self):
435435
lock = c.load("conan.lock")
436436
assert "libd/1.1" in lock
437437
assert "libd/1.2" not in lock
438+
439+
440+
def test_lock_upgrade_new_requirement(self):
441+
c = TestClient(light=True)
442+
c.save({"liba/conanfile.py": GenConanfile("liba").with_requires("libb/1.0"),
443+
"libb/conanfile.py": GenConanfile("libb").with_requires("libc/1.0"),
444+
"libc/conanfile.py": GenConanfile("libc"),
445+
"libd/conanfile.py": GenConanfile("libd")})
446+
c.run(f"export liba --version=1.0")
447+
c.run(f"export libb --version=1.0")
448+
c.run(f"export libc --version=1.0")
449+
c.run(f"export libd --version=1.0")
450+
c.save({f"conanfile.py": GenConanfile().with_requires(f"liba/[>=1.0 <2]")})
451+
c.run("lock create .")
452+
453+
c.save({"libb/conanfile.py": GenConanfile("libb").with_requires("libd/1.0")})
454+
c.run(f"export libb --version=2.0")
455+
c.run("lock upgrade --requires='libb/[>=2]' --update-requires='libb/*'")
456+
lock = c.load("conan.lock")
457+
assert "libb/2.0" in lock
458+
assert "libd/1.0" in lock
459+
assert "libc/1.0" in lock # TODO: libc should be removed from lockfile? It is not required anymore...

0 commit comments

Comments
 (0)