本文整理汇总了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)
示例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)
示例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)
示例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)
示例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])
示例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')
示例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)
示例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.',))
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)