File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ def probe(path, patterns):
1818
1919        glob_pattern  =  pattern .replace (NAMESPACE_PLACEHOLDER , "*" )
2020        for  config_file  in  glob .glob (os .path .join (path , glob_pattern )):
21-             relevant_part_of_the_path  =  config_file [len (path ) +  1 :]
21+             relevant_part_of_the_path  =  config_file   if   os . path . isabs ( pattern )  else   config_file [len (path ) +  1 :]
2222            path_parts , ext  =  os .path .splitext (relevant_part_of_the_path )
2323            path_matchers , _  =  os .path .splitext (pattern )
2424
Original file line number Diff line number Diff line change @@ -111,6 +111,13 @@ def test_dict_should_behave_as_dict(self):
111111    def  test_support_for_empty_files (self ):
112112        probe (path = _dir ("empty-files" ), patterns = ["*.*" ])
113113
114+     def  test_support_absolute_paths_outside_base_dir (self ):
115+         config  =  probe (path = _dir ("single-file-with-namespace" ), patterns = [
116+             "{}/(*)/(*)/stuff.yaml" .format (os .path .dirname (__file__ ))
117+         ])
118+         assert_that (config ['two-files-with-subdir-namespace' ].ns1 .key1 , is_ ("stuff from ns1" ))
119+         assert_that (config ['two-files-with-subdir-namespace' ].ns2 .key2 , is_ ("stuff from ns2" ))
120+ 
114121    def  test_fake_probe (self ):
115122        config  =  fake_probe ({
116123            "key" : "value" ,
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments