@@ -830,12 +830,12 @@ def _load_config_files(cls, basefilename, path=None, log=None, raise_config_file
830830
831831 if not isinstance (path , list ):
832832 path = [path ]
833- for path in path [:: - 1 ] :
833+ for current in reversed ( path ) :
834834 # path list is in descending priority order, so load files backwards:
835- pyloader = cls .python_config_loader_class (basefilename + ".py" , path = path , log = log )
835+ pyloader = cls .python_config_loader_class (basefilename + ".py" , path = current , log = log )
836836 if log :
837- log .debug ("Looking for %s in %s" , basefilename , path or os .getcwd ())
838- jsonloader = cls .json_config_loader_class (basefilename + ".json" , path = path , log = log )
837+ log .debug ("Looking for %s in %s" , basefilename , current or os .getcwd ())
838+ jsonloader = cls .json_config_loader_class (basefilename + ".json" , path = current , log = log )
839839 loaded : t .List [t .Any ] = []
840840 filenames : t .List [str ] = []
841841 for loader in [pyloader , jsonloader ]:
@@ -882,17 +882,17 @@ def load_config_file(self, filename, path=None):
882882 """Load config files by filename and path."""
883883 filename , ext = os .path .splitext (filename )
884884 new_config = Config ()
885- for (config , filename ) in self ._load_config_files (
885+ for (config , fname ) in self ._load_config_files (
886886 filename ,
887887 path = path ,
888888 log = self .log ,
889889 raise_config_file_errors = self .raise_config_file_errors ,
890890 ):
891891 new_config .merge (config )
892892 if (
893- filename not in self ._loaded_config_files
893+ fname not in self ._loaded_config_files
894894 ): # only add to list of loaded files if not previously loaded
895- self ._loaded_config_files .append (filename )
895+ self ._loaded_config_files .append (fname )
896896 # add self.cli_config to preserve CLI config priority
897897 new_config .merge (self .cli_config )
898898 self .update_config (new_config )
0 commit comments