@@ -474,6 +474,70 @@ version = "1.0.0"
474474 }
475475 _ => panic ! ( "expected a pypi package" ) ,
476476 }
477+
478+ // Trigger a re-resolve so that update_lock_file writes a new lock file
479+ // that includes another-dep. Then verify the lock file can be loaded
480+ // again — this catches URL mismatches between the environment reference
481+ // (e.g. "./another-dep") and the packages section (e.g.
482+ // "file:///tmp/.../another-dep").
483+ fs_err:: write (
484+ pixi. workspace_path ( ) . join ( "dynamic-dep/pyproject.toml" ) ,
485+ r#"[build-system]
486+ requires = ["setuptools"]
487+ build-backend = "setuptools.build_meta"
488+
489+ [project]
490+ name = "dynamic-dep"
491+ version = "50.0.0"
492+ "# ,
493+ )
494+ . unwrap ( ) ;
495+
496+ let lock = pixi. update_lock_file ( ) . await . unwrap ( ) ;
497+
498+ // The lock file written by the re-resolve must be loadable.
499+ let lock_reloaded = pixi
500+ . lock_file ( )
501+ . await
502+ . expect ( "lock file written by update_lock_file should be loadable" ) ;
503+
504+ // Both packages should be present after the round-trip through disk.
505+ assert ! (
506+ lock_reloaded. contains_pypi_package( "default" , platform, "dynamic-dep" ) ,
507+ "dynamic-dep should be present after reload"
508+ ) ;
509+ assert ! (
510+ lock_reloaded. contains_pypi_package( "default" , platform, "another-dep" ) ,
511+ "another-dep should be present after reload"
512+ ) ;
513+
514+ // Verify the in-memory lock also has both packages with correct properties.
515+ match lock
516+ . get_pypi_package ( "default" , platform, "dynamic-dep" )
517+ . expect ( "dynamic-dep should be in the re-resolved lock" )
518+ {
519+ rattler_lock:: LockedPackageRef :: Pypi ( data) => {
520+ assert ! (
521+ data. version. is_none( ) ,
522+ "dynamic-dep version should be None, got {:?}" ,
523+ data. version
524+ ) ;
525+ }
526+ _ => panic ! ( "expected a pypi package" ) ,
527+ }
528+ match lock
529+ . get_pypi_package ( "default" , platform, "another-dep" )
530+ . expect ( "another-dep should be in the re-resolved lock" )
531+ {
532+ rattler_lock:: LockedPackageRef :: Pypi ( data) => {
533+ assert ! (
534+ data. version. is_none( ) ,
535+ "another-dep version should be None for local source dep, got {:?}" ,
536+ data. version
537+ ) ;
538+ }
539+ _ => panic ! ( "expected a pypi package" ) ,
540+ }
477541}
478542
479543#[ tokio:: test]
0 commit comments