File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ mod pyproject_toml;
3131mod telemetry;
3232
3333lazy_static ! {
34- static ref POETRY_ENV_NAME_PATTERN : Regex = Regex :: new( r"^.+-[A-Za-z0-9_-]{8}-py.* $" )
34+ static ref POETRY_ENV_NAME_PATTERN : Regex = Regex :: new( r"^.+-[A-Za-z0-9_-]{8}-py\d+\.\d+ $" )
3535 . expect( "Error generating RegEx for poetry environment name pattern" ) ;
3636}
3737
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ mod tests {
3232
3333 if path_str. contains ( "pypoetry" ) && path_str. contains ( "virtualenvs" ) {
3434 if let Some ( dir_name) = path. file_name ( ) . and_then ( |n| n. to_str ( ) ) {
35- let re = Regex :: new ( r"^.+-[A-Za-z0-9_-]{8}-py.* $" ) . unwrap ( ) ;
35+ let re = Regex :: new ( r"^.+-[A-Za-z0-9_-]{8}-py\d+\.\d+ $" ) . unwrap ( ) ;
3636 return re. is_match ( dir_name) ;
3737 }
3838 }
@@ -97,8 +97,10 @@ mod tests {
9797 }
9898
9999 #[ test]
100- fn test_poetry_path_pattern_no_version ( ) {
101- assert ! ( test_poetry_cache_path_pattern(
100+ fn test_poetry_path_pattern_no_version_rejected ( ) {
101+ // Poetry always includes the Python version (major.minor) in the environment name
102+ // A name ending in just "py" without version should not match
103+ assert ! ( !test_poetry_cache_path_pattern(
102104 "/home/user/.cache/pypoetry/virtualenvs/testproject-XyZ12345-py"
103105 ) ) ;
104106 }
You can’t perform that action at this time.
0 commit comments