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


Python support.command_configure函数代码示例

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


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

示例1: test_repoid_option

 def test_repoid_option(self):
     args = ["--repo", "main"]
     self.cmd.base.repos.add(dnf.repo.Repo(name="main"))
     self.cmd.base.repos.add(dnf.repo.Repo(name="main_fail"))
     support.command_configure(self.cmd, args)
     repos = [repo.id for repo in self.cmd.base.repos.iter_enabled()]
     self.assertEqual(["main"], repos)
开发者ID:rpm-software-management,项目名称:dnf-plugins-core,代码行数:7,代码来源:test_repoclosure.py

示例2: test_configure_badargs

 def test_configure_badargs(self):
     """Test whether the command fail in case of wrong args."""
     with self.assertRaises(SystemExit) as exit, \
         support.patch_std_streams() as (stdout, stderr), \
         mock.patch('logging.Logger.critical') as clog:
         support.command_configure(self.cmd, [])
     self.assertEqual(exit.exception.code, 1)
开发者ID:Conan-Kudo,项目名称:dnf,代码行数:7,代码来源:test_commands.py

示例3: test_info

 def test_info(self):
     self.cmd = dnf.cli.commands.repoquery.RepoQueryCommand(
         support.CliStub(support.BaseCliStub()))
     support.command_configure(self.cmd, ['--source'])
     pkg = dnf.cli.commands.repoquery.PackageWrapper(PkgStub())
     self.assertEqual(self.cmd.build_format_fn(self.cmd.opts, pkg),
                      EXPECTED_SOURCERPM_FORMAT)
开发者ID:dmach,项目名称:dnf,代码行数:7,代码来源:test_repoquery.py

示例4: test_filelist

 def test_filelist(self):
     self.cmd = dnf.cli.commands.repoquery.RepoQueryCommand(
         support.CliStub(support.BaseCliStub()))
     support.command_configure(self.cmd, ['-l'])
     pkg = dnf.cli.commands.repoquery.PackageWrapper(PkgStub())
     self.assertEqual(self.cmd.build_format_fn(self.cmd.opts, pkg),
                      EXPECTED_FILELIST_FORMAT)
开发者ID:dmach,项目名称:dnf,代码行数:7,代码来源:test_repoquery.py

示例5: test_history_convert_tids

 def test_history_convert_tids(self):
     """Test history _convert_tids()."""
     cmd = dnf.cli.commands.HistoryCommand(self.cli)
     cmd.cli.base.output = mock.MagicMock()
     cmd.cli.base.output.history.last().tid = 123
     cmd.cli.base.output.history.search = mock.MagicMock(return_value=[99])
     support.command_configure(cmd, ['list', '1..5', 'last', 'last-10', 'kernel'])
     self.assertEqual(cmd._convert_tids(), [1, 2, 3, 4, 5, 99, 113, 123])
开发者ID:rpm5,项目名称:dnf,代码行数:8,代码来源:test_commands.py

示例6: test_parse_args

 def test_parse_args(self):
     cli = support.CliStub(support.BaseCliStub())
     cli.base.repos.add(support.RepoStub('silver'))
     cli.base.repos.add(support.RepoStub('screen'))
     cmd = reposync.RepoSyncCommand(cli)
     args = '-p /become/legend --repo=silver --repo=screen'.split()
     support.command_configure(cmd, args)
     self.assertEqual(cmd.opts.repo, ['silver', 'screen'])
     self.assertEqual(cmd.opts.download_path, '/become/legend')
开发者ID:1dot75cm,项目名称:dnf-plugins-core,代码行数:9,代码来源:test_reposync.py

示例7: test_obsoleted

 def test_obsoleted(self):
     self.cmd = dnf.cli.commands.check.CheckCommand(
         support.CliStub(support.BaseCliStub()))
     support.command_configure(self.cmd, ['--obsoleted'])
     with support.patch_std_streams() as (stdout, _):
         with self.assertRaises(dnf.exceptions.Error) as ctx:
             self.cmd.run()
         self.assertEqual(str(ctx.exception),
                          'Check discovered 1 problem(s)')
     self.assertEqual(stdout.getvalue(), EXPECTED_OBSOLETED_FORMAT)
开发者ID:AdamWill,项目名称:dnf,代码行数:10,代码来源:test_check.py

示例8: test_history_get_error_output_undo_transactioncheckerror

    def test_history_get_error_output_undo_transactioncheckerror(self):
        """Test get_error_output with the history undo and a TransactionCheckError."""
        cmd = dnf.cli.commands.HistoryCommand(self.cli)
        support.command_configure(cmd, ['undo', '1'])

        lines = cmd.get_error_output(dnf.exceptions.TransactionCheckError())

        self.assertEqual(
            lines,
            ('Cannot undo transaction 1, doing so would result in an '
             'inconsistent package database.',))
开发者ID:Conan-Kudo,项目名称:dnf,代码行数:11,代码来源:test_commands.py

示例9: test_conflict

 def test_conflict(self):
     with self.assertRaises(SystemExit) as sysexit, \
         support.patch_std_streams() as (stdout, stderr):
         support.command_configure(self.cmd,
                                   ['--conflicts', '%{name}', '--provides'])
     self.assertEqual(sysexit.exception.code, 1)
开发者ID:anjali-92,项目名称:dnf,代码行数:6,代码来源:test_repoquery.py

示例10: test_parse

 def test_parse(self):
     support.command_configure(self.cmd, ['--whatrequires', 'prudence'])
     self.assertIsNone(self.cmd.opts.whatprovides)
     self.assertEqual(self.cmd.opts.whatrequires, 'prudence')
     self.assertEqual(self.cmd.opts.queryformat,
                      dnf.cli.commands.repoquery.QFORMAT_DEFAULT)
开发者ID:anjali-92,项目名称:dnf,代码行数:6,代码来源:test_repoquery.py

示例11: test_configure

 def test_configure(self):
     cli = self._cmd.cli
     support.command_configure(self._cmd, ['pkg'])
     self.assertFalse(cli.demands.allow_erasing)
     self.assertTrue(cli.demands.sack_activation)
开发者ID:Conan-Kudo,项目名称:dnf,代码行数:5,代码来源:test_commands.py

示例12: test_conflict

 def test_conflict(self):
     with self.assertRaises(SystemExit) as exit:
         command_configure(self.cmd, ['--conflicts', '%{name}', '--provides'])
     self.assertEqual(exit.exception.code, 1)
开发者ID:1dot75cm,项目名称:dnf-plugins-core,代码行数:4,代码来源:test_repoquery.py

示例13: test_configure

 def test_configure(self):
     support.command_configure(self.cmd, ['remove', 'crack'])
     demands = self.cmd.cli.demands
     self.assertTrue(demands.allow_erasing)
     self.assertFalse(demands.freshest_metadata)
开发者ID:edynox,项目名称:dnf,代码行数:5,代码来源:test_group.py

示例14: test_configure_badargs

 def test_configure_badargs(self):
     """Test whether the command fail in case of wrong args."""
     with self.assertRaises(SystemExit) as exit, \
          mock.patch('sys.stdout') as stdout:
          support.command_configure(self.cmd, [])
     self.assertEqual(exit.exception.code, 1)
开发者ID:haghabozorgi,项目名称:dnf,代码行数:6,代码来源:test_commands.py

示例15: test_options

 def test_options(self):
     for arg in ('conflicts', 'enhances', 'obsoletes', 'provides',
                 'recommends', 'requires', 'suggests', 'supplements'):
         support.command_configure(self.cmd, ['--' + arg])
         self.assertEqual(self.cmd.opts.packageatr, arg)
开发者ID:anjali-92,项目名称:dnf,代码行数:5,代码来源:test_repoquery.py


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