當前位置: 首頁>>代碼示例>>Python>>正文


Python Conf.update方法代碼示例

本文整理匯總了Python中galicaster.core.conf.Conf.update方法的典型用法代碼示例。如果您正苦於以下問題:Python Conf.update方法的具體用法?Python Conf.update怎麽用?Python Conf.update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在galicaster.core.conf.Conf的用法示例。


在下文中一共展示了Conf.update方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TestFunctional

# 需要導入模塊: from galicaster.core.conf import Conf [as 別名]
# 或者: from galicaster.core.conf.Conf import update [as 別名]
class TestFunctional(TestCase):

    def setUp(self):
        """ Set up clear conf with a custom logger and repository folder.
        """
        self.conf_path = '/etc/galicaster/conf.ini'
        identifier = self.id().split('.')
        identifier.reverse()
        test_number = re.sub('\D','',identifier[0])
        self.test_path = '/tmp/test{}'.format(test_number)

        if os.path.exists(self.conf_path) and not os.path.exists('{}.old'.format(self.conf_path)):
            os.rename(self.conf_path,'{}.old'.format(self.conf_path))
        shutil.copyfile(get_resource('conf/functional_test.ini'),'/etc/galicaster/conf.ini')
        if not os.path.exists(self.test_path):
            os.makedirs('{}/logs/'.format(self.test_path))
        self.conf = Conf()

        self.conf.set('basic','repository','{}/Repository'.format(self.test_path))
        self.conf.set('logger','path','{}/logs/galicaster.log'.format(self.test_path))
        self.conf.update()

        config.load({'logDir':'{}/logs/'.format(self.test_path)})
        from . import recording

    def tearDown(self):
        os.rename(self.conf_path,'{}/conf.ini'.format(self.test_path))
        if os.path.exists('{}.old'.format(self.conf_path)):
            os.rename('{}.old'.format(self.conf_path),self.conf_path)
        recording.quit()
        del self.conf

    def test_136(self):
        """ Do 15 recordings of 10 minutes of duration
        with automatic ingest to Opencast
        """
        self.conf.set('ingest','manual','immediately')
        self.conf.set('ingest','active','true')
        self.conf.update()

        recording.start_galicaster()
        recording.rec(10*60, 15)

    def test_137(self):
        """ Check nightly ingest while recording is paused
        """
        self.conf.set('ingest','manual','nightly')
        self.conf.set('ingest','active','true')
        night = datetime.datetime.now() + datetime.timedelta(minutes=1)
        self.conf.set('heartbeat','night',night.strftime('%H:%M'))
        self.conf.update()

        recording.start_galicaster()
        recording.rec(5)
        recording.go_to_recorder()
        recording.start_recording()
        recording.pause_recording()
        remaining_sleep = night - datetime.datetime.now() 
        time.sleep(remaining_sleep.seconds)
        recording.rewind_recording()
        recording.stop_recording()
        recording.go_to_distrib()
開發者ID:SussexLearningSystems,項目名稱:Galicaster,代碼行數:64,代碼來源:__init__.py


注:本文中的galicaster.core.conf.Conf.update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。