• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tconfig.TConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_build_fail_no_spec_or_src

    def test_build_fail_no_spec_or_src(self):
        with pytest.raises(SystemExit):
            t_config = TConfig()
            t_config.DATA_DIR = os.getcwd()
            pyu = PyUpdater(t_config)
            pyu.setup()
            build_cmd = ['build', '--app-name', 'MyApp', '--clean'
                         '--app-version', '0.1.0', '-F']

            parser = get_parser()
            args, pyu_args = parser.parse_known_args(build_cmd)
            b = Builder(args, pyu_args)
            b.build()
开发者ID:timeyyy,项目名称:PyUpdater,代码行数:13,代码来源:test_builder.py


示例2: test_make_spec

    def test_make_spec(self):
        t_config = TConfig()
        t_config.DATA_DIR = os.getcwd()
        pyu = PyUpdater(t_config)
        pyu.setup()

        spec_cmd = ['make-spec', 'app.py', '-F', '--app-name', 'MyApp',
                    '--app-version', '0.1.0']
        spec_file_name = get_system() + '.spec'
        build_cmd = ['build', '--app-name', 'MyApp',
                     '--app-version', '0.1.0', spec_file_name]

        build_cmd = [str(b) for b in build_cmd]
        parser = get_parser()
        with open('app.py', 'w') as f:
            f.write('print "Hello, World!"')
        args, pyu_args = parser.parse_known_args(spec_cmd)
        b = Builder(args, pyu_args)
        b.make_spec()
        assert os.path.exists(spec_file_name)
        args, pyu_args = parser.parse_known_args(build_cmd)
        b = Builder(args, pyu_args)
        b.build()
        with ChDir(new_folder):
            assert len(os.listdir(os.getcwd())) == 1
开发者ID:timeyyy,项目名称:PyUpdater,代码行数:25,代码来源:test_builder.py


示例3: test_bad_pub_key

 def test_bad_pub_key(self):
     t_config = TConfig()
     # If changed ensure it's a valid key format
     t_config.PUBLIC_KEY = '25RSdhJ+xCsxxTjY5jffilatipp29tnKp/D5BelSMJM'
     t_config.DATA_DIR = os.getcwd()
     client = Client(t_config, refresh=True, test=True)
     assert client.update_check(client.app_name, '0.0.0') is None
开发者ID:awesome-python,项目名称:PyUpdater,代码行数:7,代码来源:test_client.py


示例4: test_set_uploader_bad_settings

def test_set_uploader_bad_settings():
    config = TConfig()
    config.ACCESS_KEY_ID = None
    config.SECRET_ACCESS_KEY = u'Not an actual secret'
    config.BUCKET_NAME = u'Bucket Name'
    s_nst = PyiUpdater(config)
    uploader = Uploader(s_nst)
    uploader.set_uploader(u's3')
开发者ID:douglasmccormickjr,项目名称:PyiUpdater,代码行数:8,代码来源:test_uploader.py


示例5: test_manifest_filesystem

 def test_manifest_filesystem(self):
     t_config = TConfig()
     t_config.PUBLIC_KEYS = ['bad key']
     t_config.DATA_DIR = os.getcwd()
     client = Client(t_config, refresh=True, test=True)
     filesystem_data = client._get_manifest_filesystem()
     filesystem_data = json.loads(filesystem_data)
     del filesystem_data['sigs']
     assert client.json_data == filesystem_data
开发者ID:timeyyy,项目名称:PyUpdater,代码行数:9,代码来源:test_client.py


示例6: test_process_packages

 def test_process_packages(self):
     data_dir = os.getcwd()
     t_config = TConfig()
     t_config.DATA_DIR = data_dir
     t_config.UPDATE_PATCHES = False
     config = Config()
     config.from_object(t_config)
     p = PackageHandler(config)
     p.process_packages()
开发者ID:awesome-python,项目名称:PyUpdater,代码行数:9,代码来源:test_package_handler.py


示例7: test_no_patch_support

 def test_no_patch_support(self, db):
     data_dir = os.getcwd()
     t_config = TConfig()
     t_config.DATA_DIR = data_dir
     t_config.UPDATE_PATCHES = False
     config = TransistionDict()
     config.from_object(t_config)
     p = PackageHandler(config, db)
     p.process_packages()
开发者ID:timeyyy,项目名称:PyUpdater,代码行数:9,代码来源:test_package_handler.py


示例8: test_init

 def test_init(self):
     data_dir = os.getcwd()
     t_config = TConfig()
     t_config.DATA_DIR = data_dir
     config = Config()
     config.from_object(t_config)
     p = PackageHandler(config)
     assert p.files_dir == os.path.join(data_dir, s_dir, 'files')
     assert p.deploy_dir == os.path.join(data_dir, s_dir, 'deploy')
开发者ID:awesome-python,项目名称:PyUpdater,代码行数:9,代码来源:test_package_handler.py


示例9: test_http

 def test_http(self):
     t_config = TConfig()
     t_config.DATA_DIR = os.getcwd()
     client = Client(t_config, refresh=True, test=True)
     update = client.update_check(client.app_name, '0.0.1')
     assert update is not None
     assert update.app_name == 'Acme'
     assert update.download() is True
     assert update.is_downloaded() is True
开发者ID:Encryptabit,项目名称:PyUpdater,代码行数:9,代码来源:test_client.py


示例10: test_http

 def test_http(client):
     t_config = TConfig()
     t_config.DATA_DIR = os.getcwd()
     t_config.VERIFY_SERVER_CERT = False
     client = Client(t_config, refresh=True, test=True)
     update = client.update_check(client.app_name, '0.0.1')
     assert update is not None
     assert update.app_name == 'jms'
     assert update.download() is True
     assert update.is_downloaded() is True
开发者ID:timeyyy,项目名称:PyUpdater,代码行数:10,代码来源:test_client.py


示例11: test_manifest_filesystem

 def test_manifest_filesystem(self):
     t_config = TConfig()
     t_config.DATA_DIR = os.getcwd()
     client = Client(t_config, refresh=True, test=True)
     filesystem_data = client._get_manifest_filesystem()
     assert filesystem_data is not None
     if six.PY3:
         filesystem_data = filesystem_data.decode()
     filesystem_data = json.loads(filesystem_data)
     del filesystem_data['signature']
     assert client.json_data == filesystem_data
开发者ID:Encryptabit,项目名称:PyUpdater,代码行数:11,代码来源:test_client.py


示例12: test_directory_creation

 def test_directory_creation(self):
     data_dir = os.getcwd()
     pyu_data_dir = os.path.join(data_dir, 'pyu-data')
     t_config = TConfig()
     t_config.DATA_DIR = data_dir
     pyu = PyUpdater(t_config)
     pyu.setup()
     assert os.path.exists(pyu_data_dir)
     assert os.path.exists(os.path.join(pyu_data_dir, 'deploy'))
     assert os.path.exists(os.path.join(pyu_data_dir, 'files'))
     assert os.path.exists(os.path.join(pyu_data_dir, 'new'))
开发者ID:JMSwag,项目名称:PyUpdater,代码行数:11,代码来源:test_pyupdater.py


示例13: test_callback

    def test_callback(self):
        def cb(status):
            print(status)

        def cb2(status):
            raise IndexError

        t_config = TConfig()
        t_config.PUBLIC_KEY = '25RSdhJ+xCsxxTjY5jffilatipp29tnKp/D5BelSMJM'
        t_config.DATA_DIR = os.getcwd()
        client = Client(t_config, refresh=True, test=True, progress_hooks=[cb])
        client.add_progress_hook(cb2)
        assert client.update_check(client.app_name, '0.0.0') is None
开发者ID:awesome-python,项目名称:PyUpdater,代码行数:13,代码来源:test_client.py


示例14: test_callback

    def test_callback(self):
        def cb(status):
            print(status)

        def cb2(status):
            raise IndexError

        t_config = TConfig()
        t_config.PUBLIC_KEYS = ['bad key']
        t_config.DATA_DIR = os.getcwd()
        client = Client(t_config, refresh=True, test=True, call_back=cb,
                        callbacks=[cb, cb2])
        client.add_call_back(cb2)
        assert client.update_check('jms', '0.0.0') is None
开发者ID:timeyyy,项目名称:PyUpdater,代码行数:14,代码来源:test_client.py


示例15: test_async_http

 def test_async_http(self):
     t_config = TConfig()
     t_config.DATA_DIR = os.getcwd()
     client = Client(t_config, refresh=True, test=True)
     update = client.update_check(client.app_name, '0.0.1')
     assert update is not None
     assert update.app_name == 'Acme'
     update.download(async=True)
     count = 0
     while count < 61:
         if update.is_downloaded() is True:
             break
         time.sleep(1)
         count += 1
     assert update.is_downloaded() is True
开发者ID:Encryptabit,项目名称:PyUpdater,代码行数:15,代码来源:test_client.py


示例16: test_build_mac_dot_app

    def test_build_mac_dot_app(self):
        t_config = TConfig()
        t_config.DATA_DIR = os.getcwd()
        pyu = PyUpdater(t_config)
        pyu.setup()

        build_cmd = ['build', '-F', '-w', '--app-name', 'MyApp',
                     '--app-version', '0.1.0', 'app.py']
        build_cmd = [str(b) for b in build_cmd]
        parser = get_parser()
        with open('app.py', 'w') as f:
            f.write('print "Hello, World!"')
        args, pyu_args = parser.parse_known_args(build_cmd)
        b = Builder(args, pyu_args)
        b.build()
        with ChDir(new_folder):
            assert len(os.listdir(os.getcwd())) == 1
开发者ID:timeyyy,项目名称:PyUpdater,代码行数:17,代码来源:test_builder.py


示例17: test_multipule_async_calls

 def test_multipule_async_calls(self, client):
     t_config = TConfig()
     t_config.DATA_DIR = os.getcwd()
     t_config.VERIFY_SERVER_CERT = False
     client = Client(t_config, refresh=True, test=True)
     update = client.update_check(client.app_name, '0.0.1')
     assert update is not None
     assert update.app_name == 'Acme'
     update.download(async=True)
     count = 0
     assert update.download(async=True) is None
     assert update.download() is None
     while count < 61:
         if update.is_downloaded() is True:
             break
         time.sleep(1)
         count += 1
     assert update.is_downloaded() is True
开发者ID:Encryptabit,项目名称:PyUpdater,代码行数:18,代码来源:test_client.py


示例18: test_build_fail_script_syntax_error

    def test_build_fail_script_syntax_error(self):
        with pytest.raises(SystemExit):
            t_config = TConfig()
            t_config.DATA_DIR = os.getcwd()
            pyu = PyUpdater(t_config)
            pyu.setup()
            spec_cmd = ['make-spec', 'app.py', '-F']
            spec_file_name = get_system() + '.spec'
            build_cmd = ['build', '--app-name', 'MyApp', '--clean'
                         '--app-version', '0.1.0', spec_file_name]

            parser = get_parser()
            with open('app.py', 'w') as f:
                # Missing closing quote
                f.write('print "Hello, World!')
            args, pyu_args = parser.parse_known_args(spec_cmd)
            b = Builder(args, pyu_args)
            b.make_spec()
            assert os.path.exists(spec_file_name)
            args, pyu_args = parser.parse_known_args(build_cmd)
            b = Builder(args, pyu_args)
开发者ID:timeyyy,项目名称:PyUpdater,代码行数:21,代码来源:test_builder.py


示例19: test_dev_dir_none

 def test_dev_dir_none(self):
     myconfig = TConfig()
     myconfig.APP_NAME = None
     updater = TransistionDict()
     updater.from_object(myconfig)
     assert updater['APP_NAME'] == 'PyUpdater App'
开发者ID:timeyyy,项目名称:PyUpdater,代码行数:6,代码来源:test_pyupdater.py


示例20: test_dev_dir_none

def test_dev_dir_none():
    updater = PyiUpdater(__name__)
    myconfig = TConfig()
    myconfig.APP_NAME = None
    updater.update_config(myconfig)
    assert updater.config[u'APP_NAME'] == u'PyiUpdater App'
开发者ID:douglasmccormickjr,项目名称:PyiUpdater,代码行数:6,代码来源:test_pyi_updater.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python commands.execute_cmd_out函数代码示例发布时间:2022-05-27
下一篇:
Python utils.pre_process_ids函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap