File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -196,17 +196,18 @@ class IdleConfTest(unittest.TestCase):
196196
197197 @classmethod
198198 def setUpClass (cls ):
199+ cls .config_string = {}
200+
199201 conf = config .IdleConf (_utest = True )
200202 if __name__ != '__main__' :
201203 idle_dir = os .path .dirname (__file__ )
202204 else :
203205 idle_dir = os .path .abspath (sys .path [0 ])
204206 for ctype in conf .config_types :
205207 config_path = os .path .join (idle_dir , '../config-%s.def' % ctype )
206- conf .defaultCfg [ctype ] = config .IdleConfParser (config_path )
207- conf .userCfg [ctype ] = config .IdleUserConfParser (config_path )
208- conf .LoadCfgFiles ()
209- cls .conf = conf
208+ with open (config_path , 'r' ) as f :
209+ cls .config_string [ctype ] = f .read ()
210+
210211 cls .orig_warn = config ._warn
211212 config ._warn = Func ()
212213
@@ -222,7 +223,12 @@ def mock_config(self):
222223
223224 Both default and user config used the same config-*.def
224225 """
225- conf = copy .deepcopy (self .conf )
226+ conf = config .IdleConf (_utest = True )
227+ for ctype in conf .config_types :
228+ conf .defaultCfg [ctype ] = config .IdleConfParser ('' )
229+ conf .defaultCfg [ctype ].read_string (self .config_string [ctype ])
230+ conf .userCfg [ctype ] = config .IdleUserConfParser ('' )
231+ conf .userCfg [ctype ].read_string (self .config_string [ctype ])
226232
227233 return conf
228234
You can’t perform that action at this time.
0 commit comments