File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 3030                        get_tcp_uri , is_lossless_cast , join_host_port ,
3131                        make_zmq_path , make_zmq_socket , memory_profiling ,
3232                        merge_async_iterators , sha256 , split_host_port ,
33-                         split_zmq_path , supports_kw , swap_dict_values )
33+                         split_zmq_path , supports_kw , swap_dict_values ,
34+                         unique_filepath )
3435
3536from  ..utils  import  create_new_process_for_each_test , error_on_warning 
3637
@@ -1032,3 +1033,17 @@ def test_load_config_file(tmp_path):
10321033    # Assert that the processed arguments match the expected output 
10331034    assert  processed_args  ==  expected_args 
10341035    os .remove (str (config_file_path ))
1036+ 
1037+ 
1038+ def  test_unique_filepath ():
1039+     # make temp directory 
1040+     temp_dir  =  tempfile .mkdtemp ()
1041+     path_fn  =  lambda  i : Path (temp_dir ) /  f"file_{ i }  .txt" 
1042+     paths  =  set ()
1043+     for  i  in  range (10 ):
1044+         path  =  unique_filepath (path_fn )
1045+         # write to file 
1046+         path .write_text ("test" )
1047+         paths .add (path )
1048+     assert  len (paths ) ==  10 
1049+     assert  len (list (Path (temp_dir ).glob ("*.txt" ))) ==  10 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments