當前位置: 首頁>>代碼示例>>Python>>正文


Python log.ERROR屬性代碼示例

本文整理匯總了Python中distutils.log.ERROR屬性的典型用法代碼示例。如果您正苦於以下問題:Python log.ERROR屬性的具體用法?Python log.ERROR怎麽用?Python log.ERROR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在distutils.log的用法示例。


在下文中一共展示了log.ERROR屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_wrong_exception_order

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import ERROR [as 別名]
def test_wrong_exception_order(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path)
        dist_files = [('xxx', '2.6', path)]  # command, pyversion, filename
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        pkg_dir, dist = self.create_dist(dist_files=dist_files)
        tests = [
            (OSError('oserror'), 'oserror', OSError),
            (HTTPError('url', 400, 'httperror', {}, None),
             'Upload failed (400): httperror', DistutilsError),
        ]
        for exception, expected, raised_exception in tests:
            with self.subTest(exception=type(exception).__name__):
                with mock.patch('distutils.command.upload.urlopen',
                                new=mock.Mock(side_effect=exception)):
                    with self.assertRaises(raised_exception):
                        cmd = upload(dist)
                        cmd.ensure_finalized()
                        cmd.run()
                    results = self.get_logs(ERROR)
                    self.assertIn(expected, results[-1])
                    self.clear_logs() 
開發者ID:CedricGuillemet,項目名稱:Imogen,代碼行數:26,代碼來源:test_upload.py

示例2: run_tests

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import ERROR [as 別名]
def run_tests(self):
        # Purge modules under test from sys.modules. The test loader will
        # re-import them from the build location. Required when 2to3 is used
        # with namespace packages.
        if six.PY3 and getattr(self.distribution, 'use_2to3', False):
            module = self.test_suite.split('.')[0]
            if module in _namespace_packages:
                del_modules = []
                if module in sys.modules:
                    del_modules.append(module)
                module += '.'
                for name in sys.modules:
                    if name.startswith(module):
                        del_modules.append(name)
                list(map(sys.modules.__delitem__, del_modules))

        exit_kwarg = {} if sys.version_info < (2, 7) else {"exit": False}
        test = unittest_main(
            None, None, self._argv,
            testLoader=self._resolve_as_ep(self.test_loader),
            testRunner=self._resolve_as_ep(self.test_runner),
            **exit_kwarg
        )
        if not test.result.wasSuccessful():
            msg = 'Test failed: %s' % test.result
            self.announce(msg, log.ERROR)
            raise DistutilsError(msg) 
開發者ID:sofia-netsurv,項目名稱:python-netsurv,代碼行數:29,代碼來源:test.py

示例3: run_tests

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import ERROR [as 別名]
def run_tests(self):
        # Purge modules under test from sys.modules. The test loader will
        # re-import them from the build location. Required when 2to3 is used
        # with namespace packages.
        if six.PY3 and getattr(self.distribution, 'use_2to3', False):
            module = self.test_suite.split('.')[0]
            if module in _namespace_packages:
                del_modules = []
                if module in sys.modules:
                    del_modules.append(module)
                module += '.'
                for name in sys.modules:
                    if name.startswith(module):
                        del_modules.append(name)
                list(map(sys.modules.__delitem__, del_modules))

        test = unittest.main(
            None, None, self._argv,
            testLoader=self._resolve_as_ep(self.test_loader),
            testRunner=self._resolve_as_ep(self.test_runner),
            exit=False,
        )
        if not test.result.wasSuccessful():
            msg = 'Test failed: %s' % test.result
            self.announce(msg, log.ERROR)
            raise DistutilsError(msg) 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:28,代碼來源:test.py

示例4: _log

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import ERROR [as 別名]
def _log(self, level, msg, args):
        if level not in (DEBUG, INFO, WARN, ERROR, FATAL):
            raise ValueError('%s wrong log level' % str(level))
        self.logs.append((level, msg, args)) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:6,代碼來源:support.py

示例5: run

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import ERROR [as 別名]
def run(self):
        msg = (
            "The upload command has been removed, use twine to upload "
            + "instead (https://pypi.org/p/twine)"
        )

        self.announce("ERROR: " + msg, log.ERROR)
        raise RemovedCommandError(msg) 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:10,代碼來源:upload.py

示例6: run

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import ERROR [as 別名]
def run(self):
        msg = (
            "The register command has been removed, use twine to upload "
            + "instead (https://pypi.org/p/twine)"
        )

        self.announce("ERROR: " + msg, log.ERROR)

        raise RemovedCommandError(msg) 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:11,代碼來源:register.py

示例7: _log

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import ERROR [as 別名]
def _log(self, level, msg, args):
        if level not in (DEBUG, INFO, WARN, ERROR, FATAL):
            raise ValueError('%s wrong log level' % str(level))
        if not isinstance(msg, str):
            raise TypeError("msg should be str, not '%.200s'"
                            % (type(msg).__name__))
        self.logs.append((level, msg, args)) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:9,代碼來源:support.py

示例8: run_tests

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import ERROR [as 別名]
def run_tests(self):
        # Purge modules under test from sys.modules. The test loader will
        # re-import them from the build location. Required when 2to3 is used
        # with namespace packages.
        if not six.PY2 and getattr(self.distribution, 'use_2to3', False):
            module = self.test_suite.split('.')[0]
            if module in _namespace_packages:
                del_modules = []
                if module in sys.modules:
                    del_modules.append(module)
                module += '.'
                for name in sys.modules:
                    if name.startswith(module):
                        del_modules.append(name)
                list(map(sys.modules.__delitem__, del_modules))

        test = unittest.main(
            None, None, self._argv,
            testLoader=self._resolve_as_ep(self.test_loader),
            testRunner=self._resolve_as_ep(self.test_runner),
            exit=False,
        )
        if not test.result.wasSuccessful():
            msg = 'Test failed: %s' % test.result
            self.announce(msg, log.ERROR)
            raise DistutilsError(msg) 
開發者ID:ali5h,項目名稱:rules_pip,代碼行數:28,代碼來源:test.py


注:本文中的distutils.log.ERROR屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。