def get_conf(args): for dir in config.find_config_dir('pwman'): if not os.path.isdir(dir): # pragma: no cover os.makedirs(dir, exist_ok=True) configp = config.Config(args.cfile, config.default_config) return configp
def get_conf(args): config_dir = os.path.expanduser("~/.pwman") if not os.path.isdir(config_dir): # pragma: no cover os.mkdir(config_dir) configp = config.Config(args.cfile, config.default_config) return configp
def __init__(self, dbver=None, filename=None, dburi=None): f = open(os.path.join(os.path.dirname(__file__), 'test.conf'), 'w') f.write(dc) f.close() self.configp = config.Config( os.path.join(os.path.dirname(__file__), "test.conf"), config.default_config) self.configp.set_value('Database', 'dburi', 'sqlite://' + testdb) if not OSX: self.xselpath = shutil.which("xsel") or "" self.configp.set_value("Global", "xsel", self.xselpath) else: self.xselpath = "xsel" self.dbver = dbver self.dburi = self.configp.get_value('Database', 'dburi')
def setUp(self): self.conf = config.Config(filename='testfile.conf', defaults=config.default_config)
def test_open_file(self): cfg = config.Config("DoesNotExist") cfg.save() self.assertTrue(os.path.exists("DoesNotExist")) os.unlink("DoesNotExist")