当前位置: 首页>>代码示例>>Python>>正文


Python conf.Conf类代码示例

本文整理汇总了Python中galicaster.core.conf.Conf的典型用法代码示例。如果您正苦于以下问题:Python Conf类的具体用法?Python Conf怎么用?Python Conf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Conf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_lower

    def test_get_lower(self):
        conf = Conf()
        for lower in ['RUBENRUA', 'RubenRua', 'RubenruA', 'rubenrua']:
            conf.set('s', 'k', lower)
            self.assertEqual(conf.get_lower('s', 'k'), 'rubenrua')

        self.assertEqual(conf.get_lower('s', 'k_not_exists'), None)
开发者ID:CGreweling,项目名称:Galicaster,代码行数:7,代码来源:conf.py

示例2: test_profile_with_no_profiles_in_files

    def test_profile_with_no_profiles_in_files(self):
        conf_file = path.join(path.dirname(path.abspath(__file__)), 'resources', 'conf', 'conf.ini')
        conf_dist_file = path.join(path.dirname(path.abspath(__file__)), 'resources', 'conf', 'conf_dist.ini')
        profiles_dir = path.join(path.dirname(path.abspath(__file__)), 'resources', 'conf', 'profiles')
        conf = Conf(conf_file, conf_dist_file, profiles_dir)

        self.assertEqual(len(conf.get_profiles()), 1)
开发者ID:qingke678,项目名称:galicaster-uib,代码行数:7,代码来源:conf.py

示例3: test_profile_with_no_profiles_in_files

    def test_profile_with_no_profiles_in_files(self):
        conf_file = get_resource('conf/conf.ini')
        conf_dist_file = get_resource('conf/conf_dist.ini')
        profiles_dir = get_resource('conf/profiles')
        conf = Conf(conf_file, conf_dist_file, profiles_dir)

        self.assertEqual(len(conf.get_profiles()), 1)
开发者ID:CGreweling,项目名称:Galicaster,代码行数:7,代码来源:conf.py

示例4: test_active_tag_default_profile

    def test_active_tag_default_profile(self):
        conf_file = get_resource('conf/conf_active.ini')
        dist_file = get_resource('conf/conf-dist.ini')
        conf = Conf(conf_file, dist_file)

        profile = conf.get_current_profile()

        self.assertEqual(1, len(profile.tracks))
开发者ID:CGreweling,项目名称:Galicaster,代码行数:8,代码来源:conf.py

示例5: TestFunctions

class TestFunctions(TestCase):

    def setUp(self):
        self.tmppath = mkdtemp()

        repo = repository.Repository(self.tmppath)
        context.set('repository', repo)

        # conf = Conf()
        # context.set('conf', conf)

        self.conf_file = get_resource('conf/conf.ini')
        self.backup_conf_file =get_resource('conf/conf.backup.ini')
        dist_file = get_resource('conf/conf-dist.ini')

        shutil.copyfile(self.conf_file,self.backup_conf_file)
        self.conf = Conf(self.conf_file,dist_file)
        self.conf.reload()



    def tearDown(self):
        rmtree(self.tmppath)
        shutil.copyfile(self.backup_conf_file,self.conf_file)
        os.remove(self.backup_conf_file)
        del self.conf


    def test_cleanstale_plugin(self):
        dispatcher = context.get_dispatcher()
        repo = context.get_repository()
        conf = context.get_conf()
        now = datetime.datetime.utcnow()

        mp = mediapackage.Mediapackage(identifier="1", title='MP#1', date=(now - datetime.timedelta(days=1)))
        repo.add(mp)
        mp = mediapackage.Mediapackage(identifier="2", title='MP#2', date=(now - datetime.timedelta(days=30)))
        repo.add(mp)
        mp = mediapackage.Mediapackage(identifier="3", title='MP#3', date=(now - datetime.timedelta(days=60)))
        repo.add(mp)
        mp = mediapackage.Mediapackage(identifier="4", title='MP#4', date=(now + datetime.timedelta(days=1)))
        repo.add(mp)
        mp = mediapackage.Mediapackage(identifier="5", title='MP#5', date=(now + datetime.timedelta(days=30)))
        repo.add(mp)


        conf.set('cleanstale','maxarchivaldays', '70')
        cleanstale.init()
        self.assertEqual(len(repo), 5)

        conf.set('cleanstale','maxarchivaldays', '50')
        cleanstale.init()
        dispatcher.emit('timer-nightly')
        self.assertEqual(len(repo), 4)
        conf.set('cleanstale','maxarchivaldays', '20')
        cleanstale.init()
        dispatcher.emit('timer-nightly')
        self.assertEqual(len(repo), 3)
开发者ID:SussexLearningSystems,项目名称:Galicaster,代码行数:58,代码来源:cleanstale.py

示例6: __get_dependencies

    def __get_dependencies(self):
        dispatcher = context.get_dispatcher()
        repo = Repository(self.tmppath)
        worker = self.WorkerMock()
        conf = Conf()
        conf.set("allows", "overlap", "False")
        logger = Logger(None)

        return dispatcher, repo, worker, conf, logger
开发者ID:rubenrua,项目名称:Galicaster,代码行数:9,代码来源:service.py

示例7: test_active_tag_default_profile

    def test_active_tag_default_profile(self):
        conf_file = get_resource('conf/conf_active.ini')
        backup_conf_active = get_resource('conf/conf_active.backup.ini')
        dist_file = get_resource('conf/conf-dist.ini')

        shutil.copyfile(conf_file, backup_conf_active)
        conf = Conf(conf_file, dist_file)
        conf.reload()
        profile = conf.get_current_profile()
        self.assertEqual(1, len(profile.tracks))
        shutil.copyfile(backup_conf_active, conf_file)
        os.remove(backup_conf_active)
开发者ID:SussexLearningSystems,项目名称:Galicaster,代码行数:12,代码来源:conf.py

示例8: test_get_hostname

 def test_get_hostname(self):
     conf = Conf()
     conf.set('config', 'ingest', None)
     conf.set('basic', 'admin', 'True')
     self.assertEqual('GCMobile-' + socket.gethostname(), conf.get_hostname())
     self.assertEqual(1, len(conf.get_tracks_in_mh_dict()))
     self.assertEqual({'capture.device.names': 'defaults'}, conf.get_tracks_in_mh_dict())
     conf.set('basic', 'admin', 'False')
     self.assertEqual('GC-' + socket.gethostname(), conf.get_hostname())
开发者ID:qingke678,项目名称:galicaster-uib,代码行数:9,代码来源:conf.py

示例9: setUp

    def setUp(self):
        conf_file = path.join(path.dirname(path.abspath(__file__)), 'resources', 'profile', 'conf_good.ini')
        conf_dist_file = path.join(path.dirname(path.abspath(__file__)), 'resources', 'profile', 'conf-dist.ini')
        folder_path = path.join(path.dirname(path.abspath(__file__)),
                                'resources', 'profile', 'folder')

        self.conf = Conf(conf_file,conf_dist_file, folder_path)
开发者ID:hectorcanto,项目名称:Galicaster,代码行数:7,代码来源:profile.py

示例10: test_get_list

    def test_get_list(self):
        conf = Conf()
        self.assertEqual(conf.get_list('s', 'k'), [])

        conf.set('s', 'k', '1 2 3 4 5 6')
        self.assertEqual(conf.get_list('s', 'k'), ['1', '2', '3', '4', '5', '6'])

        conf.set('s', 'k', 'one two three')
        self.assertEqual(conf.get_list('s', 'k'), ['one', 'two', 'three'])
开发者ID:CGreweling,项目名称:Galicaster,代码行数:9,代码来源:conf.py

示例11: setUp

    def setUp(self):
        self.conf_file = get_resource('conf/conf.ini')
        self.backup_conf_file =get_resource('conf/conf.backup.ini')
        dist_file = get_resource('conf/conf-dist.ini')

        shutil.copyfile(self.conf_file,self.backup_conf_file)
        self.conf = Conf(self.conf_file,dist_file)
        self.conf.reload()
开发者ID:SussexLearningSystems,项目名称:Galicaster,代码行数:8,代码来源:conf.py

示例12: test_get_boolean

    def test_get_boolean(self):
        conf = Conf()
        for yes in ["True", "true", "yes", "si", "y", "OK", "Y", "TRUE"]:
            conf.set("s", "k", yes)
            self.assertTrue(conf.get_boolean("s", "k"), "Check if {0} is True".format(yes))

        for no in ["None", "not", "False", "no", "n"]:
            conf.set("s", "k", no)
            self.assertFalse(conf.get_boolean("s", "k"), "Check if {0} is False".format(no))
开发者ID:rubenrua,项目名称:Galicaster,代码行数:9,代码来源:conf.py

示例13: test_invalid_ini

    def test_invalid_ini(self):
        conf_file = get_resource('conf/conf.ini')
        conf_dist_file = get_resource('conf/conf_dist.ini')
        profiles_dir = get_resource('conf/profiles')
        conf = Conf(conf_file, conf_dist_file, profiles_dir)
        conf.reload()
        old_conf = self.conf.get_all()

        content = ''
        with open(get_resource('conf/conf.ini'), 'r') as content_file:
                content = content_file.read()

        # Override conf file
        f = open(get_resource('conf/conf.ini'),'w')
        f.write('testing wrong config file')
        f.close()

        conf_dist_file = get_resource('conf/conf_dist.ini')
        profiles_dir = get_resource('conf/profiles')
        conf = Conf(conf_file, conf_dist_file, profiles_dir)
        conf.reload()
        new_conf = self.conf.get_all()

        self.assertEqual(old_conf, new_conf)

        # Override conf file
        f = open(get_resource('conf/conf.ini'),'w')
        f.write(content)
        f.close()
开发者ID:SussexLearningSystems,项目名称:Galicaster,代码行数:29,代码来源:conf.py

示例14: setUp

    def setUp(self):
        for service_name in ['conf', 'dispatcher', 'mainwindow', 'heartbeat',
                             'repository', 'occlient', 'scheduler']:
            if context.has(service_name):
                context.delete(service_name)

        self.conf_file = get_resource('conf/conf.ini')
        self.backup_conf_file =get_resource('conf/conf.backup.ini')
        dist_file = get_resource('conf/conf-dist.ini')

        shutil.copyfile(self.conf_file,self.backup_conf_file)
        self.conf = Conf(self.conf_file,dist_file)
        context.set('conf',self.conf)
        self.conf.reload()
开发者ID:SussexLearningSystems,项目名称:Galicaster,代码行数:14,代码来源:context.py

示例15: setUp

    def setUp(self):
        self.tmppath = mkdtemp()

        repo = repository.Repository(self.tmppath)
        context.set('repository', repo)

        # conf = Conf()
        # context.set('conf', conf)

        self.conf_file = get_resource('conf/conf.ini')
        self.backup_conf_file =get_resource('conf/conf.backup.ini')
        dist_file = get_resource('conf/conf-dist.ini')

        shutil.copyfile(self.conf_file,self.backup_conf_file)
        self.conf = Conf(self.conf_file,dist_file)
        self.conf.reload()
开发者ID:SussexLearningSystems,项目名称:Galicaster,代码行数:16,代码来源:cleanstale.py


注:本文中的galicaster.core.conf.Conf类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。