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


Python log.WARN屬性代碼示例

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


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

示例1: test_metadata_check_option

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import WARN [as 別名]
def test_metadata_check_option(self):
        # testing the `medata-check` option
        dist, cmd = self.get_cmd(metadata={})

        # this should raise some warnings !
        # with the `check` subcommand
        cmd.ensure_finalized()
        cmd.run()
        warnings = [msg for msg in self.get_logs(WARN) if
                    msg.startswith('warning: check:')]
        self.assertEqual(len(warnings), 2)

        # trying with a complete set of metadata
        self.clear_logs()
        dist, cmd = self.get_cmd()
        cmd.ensure_finalized()
        cmd.metadata_check = 0
        cmd.run()
        warnings = [msg for msg in self.get_logs(WARN) if
                    msg.startswith('warning: check:')]
        self.assertEqual(len(warnings), 0) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:23,代碼來源:test_sdist.py

示例2: setUp

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import WARN [as 別名]
def setUp(self):
        """Patches the environment."""
        super(PyPIRCCommandTestCase, self).setUp()
        self.tmp_dir = self.mkdtemp()
        os.environ['HOME'] = self.tmp_dir
        self.rc = os.path.join(self.tmp_dir, '.pypirc')
        self.dist = Distribution()

        class command(PyPIRCCommand):
            def __init__(self, dist):
                PyPIRCCommand.__init__(self, dist)
            def initialize_options(self):
                pass
            finalize_options = initialize_options

        self._cmd = command
        self.old_threshold = set_threshold(WARN) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:19,代碼來源:test_config.py

示例3: test_metadata_check_option

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import WARN [as 別名]
def test_metadata_check_option(self):
        # testing the `medata-check` option
        dist, cmd = self.get_cmd(metadata={})

        # this should raise some warnings !
        # with the `check` subcommand
        cmd.ensure_finalized()
        cmd.run()
        warnings = self.get_logs(WARN)
        self.assertEqual(len(warnings), 2)

        # trying with a complete set of metadata
        self.clear_logs()
        dist, cmd = self.get_cmd()
        cmd.ensure_finalized()
        cmd.metadata_check = 0
        cmd.run()
        warnings = self.get_logs(WARN)
        self.assertEqual(len(warnings), 0) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:21,代碼來源:test_sdist.py

示例4: run

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import WARN [as 別名]
def run(self):
        self.announce(
            "WARNING: Testing via this command is deprecated and will be "
            "removed in a future version. Users looking for a generic test "
            "entry point independent of test runner are encouraged to use "
            "tox.",
            log.WARN,
        )

        installed_dists = self.install_dists(self.distribution)

        cmd = ' '.join(self._argv)
        if self.dry_run:
            self.announce('skipping "%s" (dry run)' % cmd)
            return

        self.announce('running "%s"' % cmd)

        paths = map(operator.attrgetter('location'), installed_dists)
        with self.paths_on_pythonpath(paths):
            with self.project_on_sys_path():
                self.run_tests() 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:24,代碼來源:test.py

示例5: setUp

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import WARN [as 別名]
def setUp(self):
        """Patches the environment."""
        super(BasePyPIRCCommandTestCase, self).setUp()
        self.tmp_dir = self.mkdtemp()
        os.environ['HOME'] = self.tmp_dir
        self.rc = os.path.join(self.tmp_dir, '.pypirc')
        self.dist = Distribution()

        class command(PyPIRCCommand):
            def __init__(self, dist):
                PyPIRCCommand.__init__(self, dist)
            def initialize_options(self):
                pass
            finalize_options = initialize_options

        self._cmd = command
        self.old_threshold = set_threshold(WARN) 
開發者ID:CedricGuillemet,項目名稱:Imogen,代碼行數:19,代碼來源:test_config.py

示例6: setUp

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import WARN [as 別名]
def setUp(self):
        """Patches the environment."""
        super(BasePyPIRCCommandTestCase, self).setUp()
        self.tmp_dir = self.mkdtemp()
        os.environ['HOME'] = self.tmp_dir
        os.environ['USERPROFILE'] = self.tmp_dir
        self.rc = os.path.join(self.tmp_dir, '.pypirc')
        self.dist = Distribution()

        class command(PyPIRCCommand):
            def __init__(self, dist):
                PyPIRCCommand.__init__(self, dist)
            def initialize_options(self):
                pass
            finalize_options = initialize_options

        self._cmd = command
        self.old_threshold = set_threshold(WARN) 
開發者ID:pypa,項目名稱:setuptools,代碼行數:20,代碼來源:test_config.py

示例7: test_warns_deprecation

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import WARN [as 別名]
def test_warns_deprecation(capfd):
    params = dict(
        name='foo',
        packages=['name', 'name.space', 'name.space.tests'],
        namespace_packages=['name'],
        test_suite='name.space.tests.test_suite',
        use_2to3=True
    )
    dist = Distribution(params)
    dist.script_name = 'setup.py'
    cmd = test(dist)
    cmd.ensure_finalized()
    cmd.announce = mock.Mock()
    cmd.run()
    capfd.readouterr()
    msg = (
        "WARNING: Testing via this command is deprecated and will be "
        "removed in a future version. Users looking for a generic test "
        "entry point independent of test runner are encouraged to use "
        "tox."
    )
    cmd.announce.assert_any_call(msg, log.WARN) 
開發者ID:pypa,項目名稱:setuptools,代碼行數:24,代碼來源:test_test.py

示例8: run

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import WARN [as 別名]
def run(self):
        if os.system('pip freeze | grep twine'):
            self.announce('twine not installed.\nUse `pip install twine`.\nExiting.', WARN)
            sys.exit(1)

        if self.sdist:
            os.system('python setup.py sdist')

        if self.wheel:
            os.system('python setup.py bdist_wheel')

        if self.sign:
            for p in glob.glob('dist/*'):
                os.system('gpg --detach-sign -a {}'.format(p))

        os.system('twine upload dist/*')
        print('You probably want to also tag the version now:')
        print('  git tag -a {v} -m \'version {v}\''.format(v=version))
        print('  git push --tags')

        if not self.no_clean:
            shutil.rmtree('dist')
            shutil.rmtree('build')
            shutil.rmtree('oasislmf.egg-info') 
開發者ID:OasisLMF,項目名稱:OasisLMF,代碼行數:26,代碼來源:setup.py

示例9: run

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import WARN [as 別名]
def run(self):
        try:
            orig.upload.run(self)
        finally:
            self.announce(
                "WARNING: Uploading via this command is deprecated, use twine "
                "to upload instead (https://pypi.org/p/twine/)",
                log.WARN
            ) 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:11,代碼來源:upload.py

示例10: run

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import WARN [as 別名]
def run(self):
        try:
            # Make sure that we are using valid current name/version info
            self.run_command('egg_info')
            orig.register.run(self)
        finally:
            self.announce(
                "WARNING: Registering is deprecated, use twine to "
                "upload instead (https://pypi.org/p/twine/)",
                log.WARN
            ) 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:13,代碼來源:register.py

示例11: _check_template

# 需要導入模塊: from distutils import log [as 別名]
# 或者: from distutils.log import WARN [as 別名]
def _check_template(self, content):
        dist, cmd = self.get_cmd()
        os.chdir(self.tmp_dir)
        self.write_file('MANIFEST.in', content)
        cmd.ensure_finalized()
        cmd.filelist = FileList()
        cmd.read_template()
        warnings = self.get_logs(WARN)
        self.assertEqual(len(warnings), 1) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:11,代碼來源:test_sdist.py


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