File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -1878,6 +1878,43 @@ fn install_extra_index_url_has_priority() {
1878
1878
context. assert_command ( "import flask" ) . failure ( ) ;
1879
1879
}
1880
1880
1881
+ /// Ensure that the index is fetched only once when duplicate indices are specified
1882
+ #[ tokio:: test]
1883
+ async fn install_deduplicated_indices ( ) {
1884
+ let context = TestContext :: new ( "3.12" ) ;
1885
+
1886
+ let redirect_server = MockServer :: start ( ) . await ;
1887
+
1888
+ Mock :: given ( method ( "GET" ) )
1889
+ . respond_with (
1890
+ ResponseTemplate :: new ( 302 ) . insert_header ( "Location" , "https://pypi.org/simple/sniffio" ) ,
1891
+ )
1892
+ . expect ( 1 )
1893
+ . mount ( & redirect_server)
1894
+ . await ;
1895
+
1896
+ uv_snapshot ! ( context
1897
+ . pip_install( )
1898
+ . arg( "sniffio" ) // Use a zero-dependency package
1899
+ . arg( "--index" )
1900
+ . arg( redirect_server. uri( ) )
1901
+ . arg( "--default-index" )
1902
+ . arg( redirect_server. uri( ) )
1903
+ . arg( "--index-strategy" )
1904
+ . arg( "unsafe-first-match" ) , // Anything but "first-index"
1905
+ @r"
1906
+ success: true
1907
+ exit_code: 0
1908
+ ----- stdout -----
1909
+
1910
+ ----- stderr -----
1911
+ Resolved 1 package in [TIME]
1912
+ Prepared 1 package in [TIME]
1913
+ Installed 1 package in [TIME]
1914
+ + sniffio==1.3.1
1915
+ " ) ;
1916
+ }
1917
+
1881
1918
/// Install a package from a public GitHub repository
1882
1919
#[ test]
1883
1920
#[ cfg( feature = "git" ) ]
You can’t perform that action at this time.
0 commit comments