@@ -626,6 +626,7 @@ mod tests {
626626 struct VirtualEnvironmentTestCase {
627627 system_site_packages : bool ,
628628 pyvenv_cfg_version_field : Option < & ' static str > ,
629+ command_field : Option < & ' static str > ,
629630 }
630631
631632 struct PythonEnvironmentTestCase {
@@ -677,6 +678,7 @@ mod tests {
677678 let Some ( VirtualEnvironmentTestCase {
678679 pyvenv_cfg_version_field,
679680 system_site_packages,
681+ command_field,
680682 } ) = virtual_env
681683 else {
682684 return system_install_sys_prefix;
@@ -703,6 +705,10 @@ mod tests {
703705 pyvenv_cfg_contents. push_str ( version_field) ;
704706 pyvenv_cfg_contents. push ( '\n' ) ;
705707 }
708+ if let Some ( command_field) = command_field {
709+ pyvenv_cfg_contents. push_str ( command_field) ;
710+ pyvenv_cfg_contents. push ( '\n' ) ;
711+ }
706712 // Deliberately using weird casing here to test that our pyvenv.cfg parsing is case-insensitive:
707713 if * system_site_packages {
708714 pyvenv_cfg_contents. push_str ( "include-system-site-packages = TRuE\n " ) ;
@@ -934,6 +940,7 @@ mod tests {
934940 virtual_env : Some ( VirtualEnvironmentTestCase {
935941 system_site_packages : false ,
936942 pyvenv_cfg_version_field : None ,
943+ command_field : None ,
937944 } ) ,
938945 } ;
939946 test. run ( ) ;
@@ -949,6 +956,7 @@ mod tests {
949956 virtual_env : Some ( VirtualEnvironmentTestCase {
950957 system_site_packages : false ,
951958 pyvenv_cfg_version_field : Some ( "version = 3.12" ) ,
959+ command_field : None ,
952960 } ) ,
953961 } ;
954962 test. run ( ) ;
@@ -964,6 +972,7 @@ mod tests {
964972 virtual_env : Some ( VirtualEnvironmentTestCase {
965973 system_site_packages : false ,
966974 pyvenv_cfg_version_field : Some ( "version_info = 3.12" ) ,
975+ command_field : None ,
967976 } ) ,
968977 } ;
969978 test. run ( ) ;
@@ -979,6 +988,7 @@ mod tests {
979988 virtual_env : Some ( VirtualEnvironmentTestCase {
980989 system_site_packages : false ,
981990 pyvenv_cfg_version_field : Some ( "version_info = 3.12.0rc2" ) ,
991+ command_field : None ,
982992 } ) ,
983993 } ;
984994 test. run ( ) ;
@@ -994,6 +1004,7 @@ mod tests {
9941004 virtual_env : Some ( VirtualEnvironmentTestCase {
9951005 system_site_packages : false ,
9961006 pyvenv_cfg_version_field : Some ( "version_info = 3.13" ) ,
1007+ command_field : None ,
9971008 } ) ,
9981009 } ;
9991010 test. run ( ) ;
@@ -1009,6 +1020,7 @@ mod tests {
10091020 virtual_env : Some ( VirtualEnvironmentTestCase {
10101021 system_site_packages : true ,
10111022 pyvenv_cfg_version_field : Some ( "version_info = 3.13" ) ,
1023+ command_field : None ,
10121024 } ) ,
10131025 } ;
10141026 test. run ( ) ;
@@ -1096,6 +1108,25 @@ mod tests {
10961108 ) ;
10971109 }
10981110
1111+ /// See <https://github.com/astral-sh/ty/issues/430>
1112+ #[ test]
1113+ fn parsing_pyvenv_cfg_with_equals_in_value ( ) {
1114+ let test = PythonEnvironmentTestCase {
1115+ system : TestSystem :: default ( ) ,
1116+ minor_version : 13 ,
1117+ free_threaded : true ,
1118+ origin : SysPrefixPathOrigin :: VirtualEnvVar ,
1119+ virtual_env : Some ( VirtualEnvironmentTestCase {
1120+ system_site_packages : true ,
1121+ pyvenv_cfg_version_field : Some ( "version_info = 3.13" ) ,
1122+ command_field : Some (
1123+ r#"command = /.pyenv/versions/3.13.3/bin/python3.13 -m venv --without-pip --prompt="python-default/3.13.3" /somewhere-else/python/virtualenvs/python-default/3.13.3"# ,
1124+ ) ,
1125+ } ) ,
1126+ } ;
1127+ test. run ( ) ;
1128+ }
1129+
10991130 #[ test]
11001131 fn parsing_pyvenv_cfg_with_key_but_no_value_fails ( ) {
11011132 let system = TestSystem :: default ( ) ;
0 commit comments