@@ -290,12 +290,11 @@ fn verify_validity_of_interpreter_info(environment: PythonEnvironment) {
290290 && interpreter_info. clone ( ) . sys_prefix == "/usr/local/python/3.10.13" )
291291 || ( prefix. to_str ( ) . unwrap ( ) == "/usr/local/python/3.10.13"
292292 && interpreter_info. clone ( ) . sys_prefix == "/usr/local/python/current" ) )
293- || ( interpreter_info. clone ( ) . executable
294- == "/home/codespace/.python/current/bin/python"
295- && ( prefix. to_str ( ) . unwrap ( ) == "/home/codespace/.python/current"
296- && interpreter_info. clone ( ) . sys_prefix == "/usr/local/python/3.10.13" )
297- || ( prefix. to_str ( ) . unwrap ( ) == "/usr/local/python/3.10.13"
298- && interpreter_info. clone ( ) . sys_prefix == "/home/codespace/.python/current" ) )
293+ || ( interpreter_info. clone ( ) . executable == "/home/codespace/.python/current/bin/python"
294+ && ( prefix. to_str ( ) . unwrap ( ) == "/home/codespace/.python/current"
295+ && interpreter_info. clone ( ) . sys_prefix == "/usr/local/python/3.10.13" )
296+ || ( prefix. to_str ( ) . unwrap ( ) == "/usr/local/python/3.10.13"
297+ && interpreter_info. clone ( ) . sys_prefix == "/home/codespace/.python/current" ) )
299298 {
300299 // known issue https://github.com/microsoft/python-environment-tools/issues/64
301300 } else {
@@ -367,7 +366,9 @@ fn verify_we_can_get_same_env_info_using_from_with_exe(
367366 let env = PythonEnv :: new ( executable. clone ( ) , None , None ) ;
368367 let resolved =
369368 identify_python_environment_using_locators ( & env, & locators, & global_env_search_paths)
370- . unwrap_or_else ( || panic ! ( "Failed to resolve environment using `resolve` for {environment:?}" ) ) ;
369+ . unwrap_or_else ( || {
370+ panic ! ( "Failed to resolve environment using `resolve` for {environment:?}" )
371+ } ) ;
371372 trace ! (
372373 "For exe {:?} we got Environment = {:?}, To compare against {:?}" ,
373374 executable,
@@ -488,17 +489,19 @@ fn compare_environments(actual: PythonEnvironment, expected: PythonEnvironment,
488489 actual. version = expected. clone ( ) . version ;
489490
490491 if let Some ( prefix) = expected. clone ( ) . prefix {
491- if ( actual. clone ( ) . executable == Some ( PathBuf :: from ( "/usr/local/python/current/bin/python" ) )
492+ if ( actual. clone ( ) . executable
493+ == Some ( PathBuf :: from ( "/usr/local/python/current/bin/python" ) )
492494 && ( prefix. to_str ( ) . unwrap ( ) == "/usr/local/python/current"
493495 && actual. clone ( ) . prefix == Some ( PathBuf :: from ( "/usr/local/python/3.10.13" ) ) )
494496 || ( prefix. to_str ( ) . unwrap ( ) == "/usr/local/python/3.10.13"
495497 && actual. clone ( ) . prefix == Some ( PathBuf :: from ( "/usr/local/python/current" ) ) ) )
496- || ( actual. clone ( ) . executable
497- == Some ( PathBuf :: from ( "/home/codespace/.python/current/bin/python" ) )
498- && ( prefix. to_str ( ) . unwrap ( ) == "/home/codespace/.python/current"
499- && actual. clone ( ) . prefix == Some ( PathBuf :: from ( "/usr/local/python/3.10.13" ) ) )
500- || ( prefix. to_str ( ) . unwrap ( ) == "/usr/local/python/3.10.13"
501- && actual. clone ( ) . prefix == Some ( PathBuf :: from ( "/home/codespace/.python/current" ) ) ) )
498+ || ( actual. clone ( ) . executable
499+ == Some ( PathBuf :: from ( "/home/codespace/.python/current/bin/python" ) )
500+ && ( prefix. to_str ( ) . unwrap ( ) == "/home/codespace/.python/current"
501+ && actual. clone ( ) . prefix == Some ( PathBuf :: from ( "/usr/local/python/3.10.13" ) ) )
502+ || ( prefix. to_str ( ) . unwrap ( ) == "/usr/local/python/3.10.13"
503+ && actual. clone ( ) . prefix
504+ == Some ( PathBuf :: from ( "/home/codespace/.python/current" ) ) ) )
502505 {
503506 // known issue https://github.com/microsoft/python-environment-tools/issues/64
504507 actual. prefix = expected. clone ( ) . prefix ;
@@ -513,7 +516,8 @@ fn compare_environments(actual: PythonEnvironment, expected: PythonEnvironment,
513516 . iter ( )
514517 . filter ( |p| {
515518 // This is in the path, but not easy to figure out, unless we add support for codespaces or CI.
516- !( p. starts_with ( "/Users/runner/hostedtoolcache/Python" ) && p. to_string_lossy ( ) . contains ( "arm64" ) )
519+ !( p. starts_with ( "/Users/runner/hostedtoolcache/Python" )
520+ && p. to_string_lossy ( ) . contains ( "arm64" ) )
517521 } )
518522 . map ( |p| p. to_path_buf ( ) )
519523 . collect :: < Vec < PathBuf > > ( ) ,
@@ -526,30 +530,35 @@ fn compare_environments(actual: PythonEnvironment, expected: PythonEnvironment,
526530 . iter ( )
527531 . filter ( |p| {
528532 // This is in the path, but not easy to figure out, unless we add support for codespaces or CI.
529- !( p. starts_with ( "/Users/runner/hostedtoolcache/Python" ) && p. to_string_lossy ( ) . contains ( "arm64" ) )
533+ !( p. starts_with ( "/Users/runner/hostedtoolcache/Python" )
534+ && p. to_string_lossy ( ) . contains ( "arm64" ) )
530535 } )
531536 . map ( |p| p. to_path_buf ( ) )
532537 . collect :: < Vec < PathBuf > > ( ) ,
533538 ) ;
534539
535540 // if we know the arch, then verify it
536- if expected. arch . as_ref ( ) . is_some ( ) && actual. arch . as_ref ( ) . is_some ( )
537- && actual. arch . as_ref ( ) != expected. arch . as_ref ( ) {
538- error ! (
539- "Arch mismatch when using {} for {:?} and {:?}" ,
540- method, expected, actual
541- ) ;
542- }
541+ if expected. arch . as_ref ( ) . is_some ( )
542+ && actual. arch . as_ref ( ) . is_some ( )
543+ && actual. arch . as_ref ( ) != expected. arch . as_ref ( )
544+ {
545+ error ! (
546+ "Arch mismatch when using {} for {:?} and {:?}" ,
547+ method, expected, actual
548+ ) ;
549+ }
543550 actual. arch = expected. clone ( ) . arch ;
544551
545552 // if we know the prefix, then verify it
546- if expected. prefix . as_ref ( ) . is_some ( ) && actual. prefix . as_ref ( ) . is_some ( )
547- && actual. prefix . as_ref ( ) != expected. prefix . as_ref ( ) {
548- error ! (
549- "Prefirx mismatch when using {} for {:?} and {:?}" ,
550- method, expected, actual
551- ) ;
552- }
553+ if expected. prefix . as_ref ( ) . is_some ( )
554+ && actual. prefix . as_ref ( ) . is_some ( )
555+ && actual. prefix . as_ref ( ) != expected. prefix . as_ref ( )
556+ {
557+ error ! (
558+ "Prefirx mismatch when using {} for {:?} and {:?}" ,
559+ method, expected, actual
560+ ) ;
561+ }
553562 actual. prefix = expected. clone ( ) . prefix ;
554563
555564 assert_eq ! (
@@ -596,8 +605,9 @@ fn verify_we_can_get_same_env_info_using_resolve_with_exe(
596605 locator. configure ( & config) ;
597606 }
598607
599- let env = resolve_environment ( executable, & locators, & os_environment)
600- . unwrap_or_else ( || panic ! ( "Failed to resolve environment using `resolve` for {environment:?}" ) ) ;
608+ let env = resolve_environment ( executable, & locators, & os_environment) . unwrap_or_else ( || {
609+ panic ! ( "Failed to resolve environment using `resolve` for {environment:?}" )
610+ } ) ;
601611 trace ! (
602612 "For exe {:?} we got Environment = {:?}, To compare against {:?}" ,
603613 executable,
0 commit comments