@@ -806,6 +806,169 @@ fn run_with() -> Result<()> {
806806 Ok ( ( ) )
807807}
808808
809+ /// Sync all members in a workspace.
810+ #[ test]
811+ fn run_in_workspace ( ) -> Result < ( ) > {
812+ let context = TestContext :: new ( "3.12" ) ;
813+
814+ let pyproject_toml = context. temp_dir . child ( "pyproject.toml" ) ;
815+ pyproject_toml. write_str (
816+ r#"
817+ [project]
818+ name = "project"
819+ version = "0.1.0"
820+ requires-python = ">=3.12"
821+ dependencies = ["anyio>3"]
822+
823+ [build-system]
824+ requires = ["setuptools>=42"]
825+ build-backend = "setuptools.build_meta"
826+
827+ [tool.uv.workspace]
828+ members = ["child1", "child2"]
829+
830+ [tool.uv.sources]
831+ child1 = { workspace = true }
832+ child2 = { workspace = true }
833+ "# ,
834+ ) ?;
835+ context
836+ . temp_dir
837+ . child ( "src" )
838+ . child ( "project" )
839+ . child ( "__init__.py" )
840+ . touch ( ) ?;
841+
842+ let child1 = context. temp_dir . child ( "child1" ) ;
843+ child1. child ( "pyproject.toml" ) . write_str (
844+ r#"
845+ [project]
846+ name = "child1"
847+ version = "0.1.0"
848+ requires-python = ">=3.12"
849+ dependencies = ["iniconfig>1"]
850+
851+ [build-system]
852+ requires = ["setuptools>=42"]
853+ build-backend = "setuptools.build_meta"
854+ "# ,
855+ ) ?;
856+ child1
857+ . child ( "src" )
858+ . child ( "child1" )
859+ . child ( "__init__.py" )
860+ . touch ( ) ?;
861+
862+ let child2 = context. temp_dir . child ( "child2" ) ;
863+ child2. child ( "pyproject.toml" ) . write_str (
864+ r#"
865+ [project]
866+ name = "child2"
867+ version = "0.1.0"
868+ requires-python = ">=3.12"
869+ dependencies = ["typing-extensions>4"]
870+
871+ [build-system]
872+ requires = ["setuptools>=42"]
873+ build-backend = "setuptools.build_meta"
874+ "# ,
875+ ) ?;
876+ child2
877+ . child ( "src" )
878+ . child ( "child2" )
879+ . child ( "__init__.py" )
880+ . touch ( ) ?;
881+
882+ let test_script = context. temp_dir . child ( "main.py" ) ;
883+ test_script. write_str ( indoc ! { r"
884+ import anyio
885+ "
886+ } ) ?;
887+
888+ uv_snapshot ! ( context. filters( ) , context. run( ) . arg( "main.py" ) , @r###"
889+ success: true
890+ exit_code: 0
891+ ----- stdout -----
892+
893+ ----- stderr -----
894+ Resolved 8 packages in [TIME]
895+ Prepared 4 packages in [TIME]
896+ Installed 4 packages in [TIME]
897+ + anyio==4.3.0
898+ + idna==3.6
899+ + project==0.1.0 (from file://[TEMP_DIR]/)
900+ + sniffio==1.3.1
901+ "### ) ;
902+
903+ let test_script = context. temp_dir . child ( "main.py" ) ;
904+ test_script. write_str ( indoc ! { r"
905+ import iniconfig
906+ "
907+ } ) ?;
908+
909+ uv_snapshot ! ( context. filters( ) , context. run( ) . arg( "main.py" ) , @r###"
910+ success: false
911+ exit_code: 1
912+ ----- stdout -----
913+
914+ ----- stderr -----
915+ Resolved 8 packages in [TIME]
916+ Audited 4 packages in [TIME]
917+ Traceback (most recent call last):
918+ File "[TEMP_DIR]/main.py", line 1, in <module>
919+ import iniconfig
920+ ModuleNotFoundError: No module named 'iniconfig'
921+ "### ) ;
922+
923+ uv_snapshot ! ( context. filters( ) , context. run( ) . arg( "--package" ) . arg( "child1" ) . arg( "main.py" ) , @r###"
924+ success: true
925+ exit_code: 0
926+ ----- stdout -----
927+
928+ ----- stderr -----
929+ Resolved 8 packages in [TIME]
930+ Prepared 2 packages in [TIME]
931+ Installed 2 packages in [TIME]
932+ + child1==0.1.0 (from file://[TEMP_DIR]/child1)
933+ + iniconfig==2.0.0
934+ "### ) ;
935+
936+ let test_script = context. temp_dir . child ( "main.py" ) ;
937+ test_script. write_str ( indoc ! { r"
938+ import typing_extensions
939+ "
940+ } ) ?;
941+
942+ uv_snapshot ! ( context. filters( ) , context. run( ) . arg( "main.py" ) , @r###"
943+ success: false
944+ exit_code: 1
945+ ----- stdout -----
946+
947+ ----- stderr -----
948+ Resolved 8 packages in [TIME]
949+ Audited 4 packages in [TIME]
950+ Traceback (most recent call last):
951+ File "[TEMP_DIR]/main.py", line 1, in <module>
952+ import typing_extensions
953+ ModuleNotFoundError: No module named 'typing_extensions'
954+ "### ) ;
955+
956+ uv_snapshot ! ( context. filters( ) , context. run( ) . arg( "--all" ) . arg( "main.py" ) , @r###"
957+ success: true
958+ exit_code: 0
959+ ----- stdout -----
960+
961+ ----- stderr -----
962+ Resolved 8 packages in [TIME]
963+ Prepared 2 packages in [TIME]
964+ Installed 2 packages in [TIME]
965+ + child2==0.1.0 (from file://[TEMP_DIR]/child2)
966+ + typing-extensions==4.10.0
967+ "### ) ;
968+
969+ Ok ( ( ) )
970+ }
971+
809972#[ test]
810973fn run_with_editable ( ) -> Result < ( ) > {
811974 let context = TestContext :: new ( "3.12" ) ;
0 commit comments