@@ -142,6 +142,11 @@ def test_lock_export_transitive_pyrequire():
142142 c .run ("export pkg --lockfile-out=conan.lock" )
143143 lock = json .loads (c .load ("conan.lock" ))
144144 assert "pkg/0.1#dfd6bc1becb3915043a671111860baee" in lock ["requires" ][0 ]
145+ assert lock ["python_requires" ] == []
146+
147+ # but if we create
148+ c .run ("create pkg --lockfile-out=conan.lock" )
149+ lock = json .loads (c .load ("conan.lock" ))
145150 assert "dep/0.1#5d31586a2a4355d68898875dc591009a" in lock ["python_requires" ][0 ]
146151
147152
@@ -158,8 +163,9 @@ def test_pyrequires_test_package_lockfile_error():
158163 c .run ("create utils --version=1.7.1" )
159164 c .run ("create utils --version=1.8.0" )
160165 c .run ("create bar --lockfile-out=bar.lock" )
161- c .run ("create foo" , assert_error = True )
162- assert "Missing prebuilt package for 'bar/8.0'" in c .out
166+ c .run ("create foo" )
167+ c .assert_listed_require ({"utils/1.7.1" : "Cache" ,
168+ "utils/1.8.0" : "Cache" }, python = True )
163169
164170 c .run ("create foo --lockfile=bar.lock --lockfile-partial --lockfile-out=foo.lock" )
165171 c .assert_listed_require ({"utils/1.7.1" : "Cache" ,
@@ -205,16 +211,29 @@ def test_pyrequires_test_package_lockfile_error_forward():
205211 assert "Requirement 'utils/1.9.0' not in lockfile 'python_requires'" in c .out
206212
207213 # we can relax the lockfile, and it will be able to resolve,
208- # but it will still fail with missing binary for bar
209- c .run ("create foo --lockfile=bar.lock --lockfile-partial" , assert_error = True )
210- assert "Missing prebuilt package for 'bar/8.0'" in c .out
214+ c .run ("create foo --lockfile=bar.lock --lockfile-partial --lockfile-out=foo.lock" )
215+ c .assert_listed_require ({"utils/1.8.0" : "Cache" ,
216+ "utils/1.9.0" : "Cache" }, python = True )
217+ lock = json .loads (c .load ("foo.lock" ))
218+ assert "utils/1.9.0" in lock ["python_requires" ][0 ]
219+ assert "utils/1.8.0" in lock ["python_requires" ][1 ]
211220
212- c .run ("create foo --lockfile=bar.lock --lockfile-partial --build=missing "
213- "--lockfile-out=foo.lock" )
214- c .assert_listed_require ({"utils/1.9.0" : "Cache" }, python = True )
215- assert "utils/1.8.0" not in c .out
221+ # BUT this build is NOT REPRODUCIBLE with this lockfile!
222+ c .run ("create foo --lockfile=foo.lock" , assert_error = True )
223+ assert "ERROR: Missing prebuilt package for 'bar/8.0'" in c .out
216224
217- # This build is reproducible with this lockfile
218- c .run ("create foo --lockfile=foo.lock" )
225+ # The correct solution is to properly "lock create" the lockfile
226+ c .run ("lock create foo --lockfile=bar.lock --lockfile-out=foo.lock" )
227+ c .assert_listed_require ({"utils/1.9.0" : "Cache" ,
228+ "utils/1.8.0" : "Cache" }, python = True )
229+ lock = json .loads (c .load ("foo.lock" ))
230+ assert "utils/1.9.0" in lock ["python_requires" ][0 ]
231+ assert "utils/1.8.0" in lock ["python_requires" ][1 ]
232+
233+ # It will return build missing error
234+ c .run ("create foo --lockfile=foo.lock" , assert_error = True )
235+ assert "ERROR: Missing prebuilt package for 'bar/8.0'" in c .out
236+
237+ c .run ("create foo --lockfile=foo.lock --build=missing" )
219238 c .assert_listed_require ({"utils/1.9.0" : "Cache" }, python = True )
220239 assert "utils/1.8.0" not in c .out
0 commit comments