예제 #1
0
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
예제 #2
0
파일: __init__.py 프로젝트: donnm/pwman3
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
예제 #3
0
    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')
예제 #4
0
 def setUp(self):
     self.conf = config.Config(filename='testfile.conf',
                               defaults=config.default_config)
예제 #5
0
 def test_open_file(self):
     cfg = config.Config("DoesNotExist")
     cfg.save()
     self.assertTrue(os.path.exists("DoesNotExist"))
     os.unlink("DoesNotExist")