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