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


Python support.wiretap_logs函数代码示例

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


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

示例1: test_install_installed

 def test_install_installed(self):
     """Test that nothing changes if an installed package matches."""
     stdout = dnf.pycomp.StringIO()
     with support.wiretap_logs("dnf", logging.WARNING, stdout):
         self.base.install("librita")
     self.assertEqual(self.base.goal.req_length(), 0)
     self.assertIn("Package librita-1-1.x86_64 is already installed, skipping.", stdout.getvalue())
开发者ID:hiddenk,项目名称:dnf,代码行数:7,代码来源:test_install.py

示例2: test_install_unavailable

 def test_install_unavailable(self):
     """Test that nothing changes if an unavailable package matches."""
     stdout = dnf.pycomp.StringIO()
     with support.wiretap_logs("dnf", logging.WARNING, stdout):
         cnt = self.base.install("hole")
     self.assertEqual(cnt, 1)
     installed_pkgs = self.base.sack.query().installed().run()
     self.assertResult(self.base, installed_pkgs)
     self.assertIn("Package hole-1-1.x86_64 is already installed, skipping.", stdout.getvalue())
开发者ID:hiddenk,项目名称:dnf,代码行数:9,代码来源:test_install.py

示例3: test_run_notfound

    def test_run_notfound(self):
        """Test whether it fails if the package cannot be found."""
        stdout = dnf.pycomp.StringIO()

        with support.wiretap_logs("dnf", logging.INFO, stdout):
            self.assertRaises(dnf.exceptions.Error, support.command_run, self.cmd, ["non-existent"])

        self.assertEqual(stdout.getvalue(), "No match for argument: non-existent\n")
        self.assertResult(self.cmd.base, self.cmd.base.sack.query().installed())
开发者ID:Akasurde,项目名称:dnf,代码行数:9,代码来源:test_remove.py

示例4: test_run_notinstalled

    def test_run_notinstalled(self):
        """Test whether it fails if the package is not installed."""
        stdout = dnf.pycomp.StringIO()

        with support.wiretap_logs('dnf', logging.INFO, stdout):
            self.assertRaises(dnf.exceptions.Error, support.command_run, self._cmd, ['lotus'])

        self.assertEqual(stdout.getvalue(), 'No match for argument: lotus\n')
        self.assertResult(self._cmd.cli.base,
                          self._cmd.cli.base.sack.query().installed())
开发者ID:Conan-Kudo,项目名称:dnf,代码行数:10,代码来源:test_commands.py

示例5: test_install_name_choice

    def test_install_name_choice(self):
        """Test that the matching pkg that can be installed is installed."""
        # Don't install the SRPM.
        self.base.sack.add_excludes(dnf.subject.Subject("pepper.src").get_best_query(self.base.sack))

        stdout = dnf.pycomp.StringIO()
        with support.wiretap_logs("dnf", logging.WARNING, stdout):
            self.base.install("pepper")
        self.assertEqual(self.base.goal.req_length(), 0)
        self.assertIn("Package pepper-20-0.x86_64 is already installed, skipping.", stdout.getvalue())
开发者ID:hiddenk,项目名称:dnf,代码行数:10,代码来源:test_install.py

示例6: test_updatePkgs_notfound

    def test_updatePkgs_notfound(self):
        """Test whether it fails if the package cannot be found."""
        stdout = dnf.pycomp.StringIO()

        with support.wiretap_logs('dnf', logging.INFO, stdout):
            self.assertRaises(dnf.exceptions.Error,
                              self.cmd.run, ['non-existent'])

        self.assertEqual(stdout.getvalue(),
                         'No match for argument: non-existent\n')
        self.assertResult(self.cmd.base, self.cmd.base.sack.query().installed())
开发者ID:MattSturgeon,项目名称:dnf,代码行数:11,代码来源:test_commands.py

示例7: test_install_installed

 def test_install_installed(self):
     """Test that nothing changes if an installed package matches."""
     stdout = dnf.pycomp.StringIO()
     with support.wiretap_logs('dnf', logging.WARNING, stdout):
         self.base.install('librita')
     installed, removed = self.installed_removed(self.base)
     self.assertEmpty(installed)
     self.assertEmpty(removed)
     self.assertIn(
         'Package librita-1-1.x86_64 is already installed, skipping.',
         stdout.getvalue())
开发者ID:dmach,项目名称:dnf,代码行数:11,代码来源:test_install.py

示例8: test_run_on_repo_all_notinstalled

    def test_run_on_repo_all_notinstalled(self):
        """Test running with a repository from which nothing is installed."""
        stdout = dnf.pycomp.StringIO()

        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.wiretap_logs('dnf', logging.INFO, stdout):
            self.assertRaises(dnf.exceptions.Error,
                              support.command_run, cmd,
                              ['non-distro', 'remove-or-distro-sync'])

        self.assertIn('No package installed from the repository.\n',
                      stdout.getvalue(), 'mismatch not logged')
开发者ID:Conan-Kudo,项目名称:dnf,代码行数:12,代码来源:test_commands.py

示例9: test_run_on_repo_spec_notinstalled

    def test_run_on_repo_spec_notinstalled(self):
        """Test running with a package which is not installed."""
        stdout = dnf.pycomp.StringIO()

        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.wiretap_logs('dnf', logging.INFO, stdout):
            self.assertRaises(dnf.exceptions.Error,
                              support.command_run, cmd,
                              ['non-distro', 'remove-or-distro-sync', 'not-installed'])

        self.assertIn('No match for argument: not-installed\n', stdout.getvalue(),
                      'mismatch not logged')
开发者ID:Conan-Kudo,项目名称:dnf,代码行数:12,代码来源:test_commands.py

示例10: test_run_group_notfound

    def test_run_group_notfound(self):
        """Test whether it fails if the group cannot be found."""
        stdout = dnf.pycomp.StringIO()

        with support.wiretap_logs('dnf', logging.INFO, stdout):
            self.assertRaises(dnf.exceptions.Error,
                              support.command_run, self._cmd, ['@non-existent'])

        self.assertEqual(stdout.getvalue(),
                         "Warning: Group 'non-existent' does not exist.\n")
        self.assertResult(self._cmd.cli.base,
                          self._cmd.cli.base.sack.query().installed())
开发者ID:Conan-Kudo,项目名称:dnf,代码行数:12,代码来源:test_commands.py

示例11: test_run_package_notfound

    def test_run_package_notfound(self):
        """Test whether it fails if the package cannot be found."""
        stdout = dnf.pycomp.StringIO()

        with support.wiretap_logs('dnf', logging.INFO, stdout):
            self.assertRaises(dnf.exceptions.Error,
                              self._cmd.run, ['non-existent', 'lotus'])

        self.assertEqual(stdout.getvalue(),
                         'No package non-existent available.\n')
        self.assertResult(self._cmd.cli.base,
                          self._cmd.cli.base.sack.query().installed())
开发者ID:Aftermath,项目名称:dnf,代码行数:12,代码来源:test_commands.py

示例12: test_run_package_notfound

    def test_run_package_notfound(self):
        """Test whether it fails if the package cannot be found."""
        stdout = dnf.pycomp.StringIO()

        with support.wiretap_logs('dnf', logging.INFO, stdout):
            self.assertRaises(dnf.exceptions.Error,
                              support.command_run, self._cmd, ['non-existent', 'lotus'])

        self.assertEqual(stdout.getvalue(),
                         'No package non-existent available.\n')
        base = self._cmd.cli.base
        self.assertResult(base, itertools.chain(
              base.sack.query().installed(),
              dnf.subject.Subject('lotus.x86_64').get_best_query(base.sack)))
开发者ID:Conan-Kudo,项目名称:dnf,代码行数:14,代码来源:test_commands.py

示例13: test_install_name_choice

    def test_install_name_choice(self):
        """Test that the matching pkg that can be installed is installed."""
        # Don't install the SRPM.
        self.base.sack.add_excludes(
            dnf.subject.Subject('pepper.src').get_best_query(self.base.sack))

        stdout = dnf.pycomp.StringIO()
        with support.wiretap_logs('dnf', logging.WARNING, stdout):
            self.base.install('pepper')
        installed, removed = self.installed_removed(self.base)
        self.assertEmpty(installed | removed)
        self.assertIn(
            'Package pepper-20-0.x86_64 is already installed, skipping.',
            stdout.getvalue())
开发者ID:dmach,项目名称:dnf,代码行数:14,代码来源:test_install.py

示例14: test_run_notavailable

    def test_run_notavailable(self):
        """Test whether it fails if the package is not available."""
        base = self._cmd.cli.base
        holes_query = dnf.subject.Subject('hole').get_best_query(base.sack)
        for pkg in holes_query.installed():
            self._cmd.base._yumdb.db[str(pkg)] = support.RPMDBAdditionalDataPackageStub()
            self._cmd.base._yumdb.get_package(pkg).from_repo = 'unknown'
        stdout = dnf.pycomp.StringIO()

        with support.wiretap_logs('dnf', logging.INFO, stdout):
            self.assertRaises(dnf.exceptions.Error, support.command_run, self._cmd, ['hole'])

        self.assertEqual(
            stdout.getvalue(),
            'Installed package hole-1-1.x86_64 (from unknown) not available.\n')
        self.assertResult(base, base.sack.query().installed())
开发者ID:Conan-Kudo,项目名称:dnf,代码行数:16,代码来源:test_commands.py

示例15: test_run_notavailable

    def test_run_notavailable(self):
        """ Test whether it fails if the package is not available. """
        base = self._cmd.cli.base
        holes_query = dnf.subject.Subject('hole').get_best_query(base.sack)
        history = self._cmd.base.history
        for pkg in holes_query.installed():
            mockSwdbPkg(history, pkg)

        stdout = dnf.pycomp.StringIO()

        with support.wiretap_logs('dnf', logging.INFO, stdout):
            self.assertRaises(dnf.exceptions.Error, support.command_run, self._cmd, ['hole'])

        self.assertEqual(
            stdout.getvalue(),
            'Installed package hole-1-1.x86_64 (from unknown) not available.\n')
        self.assertResult(base, base.sack.query().installed())
开发者ID:edynox,项目名称:dnf,代码行数:17,代码来源:test_commands.py


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