Exemple #1
0
 def setUp(self):
     self.config = tempfile.NamedTemporaryFile(suffix='.json')
     self.config.close()
     
     self.config_path, self.config_filename = os.path.split(self.config.name) 
     def load(*args):
         return [self.config_path]
     def save(*args):
         return self.config_path
     keys.load_config_paths = load
     keys.save_config_path = save
     self.wk = keys.WheelKeys()
     self.wk.CONFIG_NAME = self.config_filename
Exemple #2
0
def wheel_keys(tmpdir, monkeypatch):
    def load(*args):
        return [config_path.dirname]

    def save(*args):
        return config_path.dirname

    config_path = tmpdir.join('config.json')
    config_path.write(b'')

    monkeypatch.setattr(keys, 'load_config_paths', load)
    monkeypatch.setattr(keys, 'save_config_path', save)

    wk = keys.WheelKeys()
    wk.CONFIG_NAME = config_path.basename
    return wk