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


Python helpers.capture_json_with_argv函数代码示例

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


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

示例1: test_info

    def test_info(self):
        res = capture_json_with_argv('conda', 'info', '--json')
        keys = ('channels', 'conda_version', 'default_prefix', 'envs',
                'envs_dirs', 'is_foreign', 'pkgs_dirs', 'platform',
                'python_version', 'rc_path', 'root_prefix', 'root_writable')
        self.assertTrue(all(key in res for key in keys))

        res = capture_json_with_argv('conda', 'info', 'conda', '--json')
        self.assertIsInstance(res, dict)
        self.assertTrue('conda' in res)
        self.assertIsInstance(res['conda'], list)
开发者ID:aldanor,项目名称:conda,代码行数:11,代码来源:test_cli.py

示例2: test_info

    def test_info(self):
        res = capture_json_with_argv('conda info --json')
        keys = ('channels', 'conda_version', 'default_prefix', 'envs',
                'envs_dirs', 'pkgs_dirs', 'platform',
                'python_version', 'rc_path', 'root_prefix', 'root_writable')
        self.assertIsInstance(res, dict)
        for key in keys:
            assert key in res

        res = capture_json_with_argv('conda info conda --json')
        self.assertIsInstance(res, dict)
        self.assertIn('conda', res)
        self.assertIsInstance(res['conda'], list)
开发者ID:jaimergp,项目名称:conda,代码行数:13,代码来源:test_cli.py

示例3: test_info

    def test_info(self, _mocked_guetf):
        res = capture_json_with_argv('conda info --json')
        keys = ('channels', 'conda_version', 'default_prefix', 'envs',
                'envs_dirs', 'pkgs_dirs', 'platform',
                'python_version', 'rc_path', 'root_prefix', 'root_writable')
        self.assertIsInstance(res, dict)
        for key in keys:
            assert key in res

        res = capture_json_with_argv('conda info conda --json', disallow_stderr=False,
                                     ignore_stderr=True)
        self.assertIsInstance(res, dict)
        self.assertIn('conda', res)
        self.assertIsInstance(res['conda'], list)
        assert _mocked_guetf.call_count > 0
开发者ID:mingwandroid,项目名称:conda,代码行数:15,代码来源:test_cli.py

示例4: test_list

    def test_list(self):
        res = capture_json_with_argv('conda', 'list', '--json')
        self.assertIsInstance(res, list)

        res = capture_json_with_argv('conda', 'list', '-r', '--json')
        self.assertTrue(isinstance(res, list) or
                        (isinstance(res, dict) and 'error' in res))

        res = capture_json_with_argv('conda', 'list', 'ipython', '--json')
        self.assertIsInstance(res, list)

        res = capture_json_with_argv('conda', 'list', '--name', 'nonexistent', '--json')
        self.assertJsonError(res)

        res = capture_json_with_argv('conda', 'list', '--name', 'nonexistent', '-r', '--json')
        self.assertJsonError(res)
开发者ID:AmandaZZZ,项目名称:conda,代码行数:16,代码来源:test_cli.py

示例5: test_config

    def test_config(self):
        res = capture_json_with_argv('conda', 'config', '--get', '--json')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'config', '--get', 'channels',
                                     '--json')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'config', '--get', 'channels',
                                     '--system', '--json')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'config', '--get', 'channels',
                                     '--file', 'tmpfile.rc', '--json')
        self.assertJsonSuccess(res)

        # res = capture_json_with_argv('conda', 'config', '--add', 'channels',
        #                              'binstar', '--json')
        # self.assertIsInstance(res, dict)
        #
        # res = capture_json_with_argv('conda', 'config', '--add', 'channels',
        #                              'binstar', '--force', '--json')
        # self.assertJsonSuccess(res)
        #
        # res = capture_json_with_argv('conda', 'config', '--remove', 'channels',
        #                              'binstar', '--json')
        # self.assertJsonError(res)
        #
        # res = capture_json_with_argv('conda', 'config', '--remove', 'channels',
        #                              'binstar', '--force', '--json')
        # self.assertJsonSuccess(res)
        #
        # res = capture_json_with_argv('conda', 'config', '--remove', 'channels',
        #                              'nonexistent', '--force', '--json')
        # self.assertJsonError(res)
        #
        # res = capture_json_with_argv('conda', 'config', '--remove', 'envs_dirs',
        #                              'binstar', '--json')
        # self.assertJsonError(res)
        #
        # res = capture_json_with_argv('conda', 'config', '--set', 'use_pip',
        #                              'yes', '--json')
        # self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'config', '--get', 'use_pip',
                                     '--json')
        self.assertJsonSuccess(res)
开发者ID:525152625,项目名称:conda,代码行数:47,代码来源:test_cli.py

示例6: test_search

    def test_search(self):
        with captured():
            res = capture_json_with_argv('conda search --json')
        self.assertIsInstance(res, dict)
        self.assertIsInstance(res['conda'], list)
        self.assertIsInstance(res['conda'][0], dict)
        keys = ('build', 'channel', 'extracted', 'features', 'fn',
                'installed', 'version')
        for key in keys:
            self.assertIn(key, res['conda'][0])

        stdout, stderr, rc = run_inprocess_conda_command('conda search * --json')
        assert json.loads(stdout.strip())['exception_name'] == 'CommandArgumentError'
        assert stderr == ''
        assert rc > 0

        res = capture_json_with_argv('conda search --canonical --json')
        self.assertIsInstance(res, list)
        self.assertIsInstance(res[0], text_type)
开发者ID:jaimergp,项目名称:conda,代码行数:19,代码来源:test_cli.py

示例7: test_list

    def test_list(self):
        res = capture_json_with_argv('conda list --json')
        self.assertIsInstance(res, list)

        res = capture_json_with_argv('conda list -r --json')
        self.assertTrue(isinstance(res, list) or
                        (isinstance(res, dict) and 'error' in res))

        res = capture_json_with_argv('conda list ipython --json')
        self.assertIsInstance(res, list)

        stdout, stderr, rc = run_inprocess_conda_command('conda list --name nonexistent --json')
        assert json.loads(stdout.strip())['exception_name'] == 'CondaEnvironmentNotFoundError'
        assert stderr == ''
        assert rc > 0

        stdout, stderr, rc = run_inprocess_conda_command('conda list --name nonexistent --revisions --json')
        assert json.loads(stdout.strip())['exception_name'] == 'CondaEnvironmentNotFoundError'
        assert stderr == ''
        assert rc > 0
开发者ID:jaimergp,项目名称:conda,代码行数:20,代码来源:test_cli.py

示例8: test_search_0

    def test_search_0(self):
        with captured():
            res = capture_json_with_argv('conda search --json')
        self.assertIsInstance(res, dict)
        self.assertIsInstance(res['conda'], list)
        self.assertIsInstance(res['conda'][0], dict)
        keys = ('build', 'channel', 'fn', 'version')
        for key in keys:
            self.assertIn(key, res['conda'][0])

        stdout, stderr, rc = run_inprocess_conda_command('conda search * --json')
        assert stderr == ''
        assert rc is None
开发者ID:mingwandroid,项目名称:conda,代码行数:13,代码来源:test_cli.py

示例9: test_search

    def test_search(self):
        res = capture_json_with_argv('conda', 'search', '--json')
        self.assertIsInstance(res, dict)
        self.assertIsInstance(res['_license'], list)
        self.assertIsInstance(res['_license'][0], dict)
        keys = ('build', 'channel', 'extracted', 'features', 'fn',
                'installed', 'version')
        self.assertTrue(all(key in res['_license'][0] for key in keys))
        for res in (capture_json_with_argv('conda', 'search', 'ipython', '--json'),
            capture_json_with_argv('conda', 'search', '--unknown', '--json'),
            capture_json_with_argv('conda', 'search', '--use-index-cache', '--json'),
            capture_json_with_argv('conda', 'search', '--outdated', '--json'),
            capture_json_with_argv('conda', 'search', '-c', 'https://conda.binstar.org/asmeurer', '--json'),
            capture_json_with_argv('conda', 'search', '-c', 'https://conda.binstar.org/asmeurer', '--override-channels', '--json'),
            capture_json_with_argv('conda', 'search', '--platform', 'win-32', '--json'),):
            self.assertIsInstance(res, dict)

        res = capture_json_with_argv('conda', 'search', '*', '--json')
        self.assertJsonError(res)

        res = capture_json_with_argv('conda', 'search', '--canonical', '--json')
        self.assertIsInstance(res, list)
        self.assertIsInstance(res[0], text_type)
开发者ID:aldanor,项目名称:conda,代码行数:23,代码来源:test_cli.py

示例10: test_list

    def test_list(self, mockable_context_envs_dirs):
        mockable_context_envs_dirs.return_value = (self.tmpdir,)
        res = capture_json_with_argv('conda list --json')
        self.assertIsInstance(res, list)

        res = capture_json_with_argv('conda list -r --json')
        self.assertTrue(isinstance(res, list) or
                        (isinstance(res, dict) and 'error' in res))

        res = capture_json_with_argv('conda list ipython --json')
        self.assertIsInstance(res, list)

        stdout, stderr, rc = run_inprocess_conda_command('conda list --name nonexistent --json')
        assert json.loads(stdout.strip())['exception_name'] == 'EnvironmentLocationNotFound'
        assert stderr == ''
        assert rc > 0

        stdout, stderr, rc = run_inprocess_conda_command('conda list --name nonexistent --revisions --json')
        assert json.loads(stdout.strip())['exception_name'] == 'EnvironmentLocationNotFound'
        assert stderr == ''
        assert rc > 0

        assert mockable_context_envs_dirs.call_count > 0
开发者ID:mingwandroid,项目名称:conda,代码行数:23,代码来源:test_cli.py

示例11: test_config

    def test_config(self):
        res = capture_json_with_argv('conda config --get --json')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda config --get channels --json')
        self.assertJsonSuccess(res)

        if context.root_writable:
            res = capture_json_with_argv('conda config --get channels --system --json')
            self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda config --get channels --file tempfile.rc --json')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda config --get channels --file tempfile.rc --file tempfile.rc --json')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda config --get use_pip --json')
        self.assertJsonSuccess(res)
开发者ID:mingwandroid,项目名称:conda,代码行数:19,代码来源:test_cli.py

示例12: test_search_2

 def test_search_2(self):
     self.assertIsInstance(capture_json_with_argv('conda search --unknown --json'), dict)
开发者ID:jaimergp,项目名称:conda,代码行数:2,代码来源:test_cli.py

示例13: test_install

    def test_install(self):
        res = capture_json_with_argv('conda', 'install', 'pip', '--json', '--quiet')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'update', 'pip', '--json', '--quiet')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'remove', 'pip', '--json', '--quiet')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'remove', 'pip', '--json', '--quiet')
        self.assertJsonError(res)

        res = capture_json_with_argv('conda', 'update', 'pip', '--json', '--quiet')
        self.assertJsonError(res)

        res = capture_json_with_argv('conda', 'install', 'pip=1.5.5', '--json', '--quiet')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'install', '=', '--json', '--quiet')
        self.assertJsonError(res)

        res = capture_json_with_argv('conda', 'remove', '-n', 'testing',
                                     '--all', '--json', '--quiet')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'remove', '-n', 'testing',
                                     '--all', '--json', '--quiet')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'remove', '-n', 'testing2',
                                     '--all', '--json', '--quiet')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'create', '-n', 'testing',
                                     'python', '--json', '--quiet')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'install', '-n', 'testing',
                                     'python', '--json', '--quiet')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'install', '--dry-run',
                                     'python', '--json', '--quiet')
        self.assertJsonSuccess(res)

        res = capture_json_with_argv('conda', 'create', '--clone', 'testing',
                                     '-n', 'testing2', '--json', '--quiet')
        self.assertJsonSuccess(res)
开发者ID:aldanor,项目名称:conda,代码行数:49,代码来源:test_cli.py

示例14: test_search_4

 def test_search_4(self):
     self.assertIsInstance(capture_json_with_argv('conda search --json --use-index-cache'), dict)
开发者ID:mingwandroid,项目名称:conda,代码行数:2,代码来源:test_cli.py

示例15: test_search_5

 def test_search_5(self):
     self.assertIsInstance(capture_json_with_argv('conda search --platform win-32 --json'), dict)
开发者ID:mingwandroid,项目名称:conda,代码行数:2,代码来源:test_cli.py


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