@@ -472,7 +472,7 @@ fn get_winpython_search_paths() -> Vec<PathBuf> {
472472/// WINPYTHON_HOME values. Extracted from `get_winpython_search_paths` so
473473/// tests can pin down the policy without mutating process env vars (which
474474/// races between parallel tests).
475- #[ allow ( dead_code ) ]
475+ #[ cfg ( any ( windows , test ) ) ]
476476fn build_search_paths ( userprofile : Option < String > , winpython_home : Option < String > ) -> Vec < PathBuf > {
477477 let mut paths: Vec < PathBuf > = Vec :: new ( ) ;
478478 let mut seen: std:: collections:: HashSet < PathBuf > = std:: collections:: HashSet :: new ( ) ;
@@ -747,7 +747,11 @@ mod tests {
747747 fn test_search_paths_exclude_drive_roots_and_program_files ( ) {
748748 let paths = build_search_paths ( Some ( r"C:\Users\test" . to_string ( ) ) , None ) ;
749749
750- assert_eq ! ( paths, vec![ PathBuf :: from( r"C:\Users\test\WinPython" ) ] ) ;
750+ // `norm_case` may rewrite casing or representation when the path
751+ // happens to exist on the test host; compare against the same
752+ // normalization to keep the assertion machine-independent.
753+ let expected = norm_case ( PathBuf :: from ( r"C:\Users\test\WinPython" ) ) ;
754+ assert_eq ! ( paths, vec![ expected] ) ;
751755
752756 for p in & paths {
753757 let s = p. to_string_lossy ( ) . to_lowercase ( ) ;
@@ -791,11 +795,14 @@ mod tests {
791795
792796 #[ cfg( windows) ]
793797 let expected = vec ! [
794- PathBuf :: from( r"D:\WPy64-31300" ) ,
795- PathBuf :: from( r"E:\custom" ) ,
798+ norm_case ( PathBuf :: from( r"D:\WPy64-31300" ) ) ,
799+ norm_case ( PathBuf :: from( r"E:\custom" ) ) ,
796800 ] ;
797801 #[ cfg( not( windows) ) ]
798- let expected = vec ! [ PathBuf :: from( "/opt/wpy" ) , PathBuf :: from( "/srv/wpy" ) ] ;
802+ let expected = vec ! [
803+ norm_case( PathBuf :: from( "/opt/wpy" ) ) ,
804+ norm_case( PathBuf :: from( "/srv/wpy" ) ) ,
805+ ] ;
799806
800807 assert_eq ! ( paths, expected) ;
801808 }
@@ -812,6 +819,6 @@ mod tests {
812819 let extra = default_path. to_string_lossy ( ) . to_string ( ) ;
813820
814821 let paths = build_search_paths ( Some ( home) , Some ( extra) ) ;
815- assert_eq ! ( paths, vec![ default_path] ) ;
822+ assert_eq ! ( paths, vec![ norm_case ( default_path) ] ) ;
816823 }
817824}
0 commit comments