mirror of https://github.com/python/cpython
Fix format of warnings from the packaging check command
This commit is contained in:
parent
78af7d8392
commit
8c86ecdab5
|
@ -32,7 +32,7 @@ class check(Command):
|
||||||
# XXX we could use a special handler for this, but would need to test
|
# XXX we could use a special handler for this, but would need to test
|
||||||
# if it works even if the logger has a too high level
|
# if it works even if the logger has a too high level
|
||||||
self._warnings.append((msg, args))
|
self._warnings.append((msg, args))
|
||||||
return logger.warning(self.get_command_name() + msg, *args)
|
return logger.warning('%s: %s' % (self.get_command_name(), msg), *args)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Runs the command."""
|
"""Runs the command."""
|
||||||
|
|
|
@ -124,6 +124,17 @@ class CheckTestCase(support.LoggingCatcher,
|
||||||
cmd.check_hooks_resolvable()
|
cmd.check_hooks_resolvable()
|
||||||
self.assertEqual(len(self.get_logs(logging.WARNING)), 1)
|
self.assertEqual(len(self.get_logs(logging.WARNING)), 1)
|
||||||
|
|
||||||
|
def test_warn(self):
|
||||||
|
_, dist = self.create_dist()
|
||||||
|
cmd = check(dist)
|
||||||
|
self.assertEqual([], self.get_logs())
|
||||||
|
cmd.warn('hello')
|
||||||
|
self.assertEqual(['check: hello'], self.get_logs())
|
||||||
|
cmd.warn('hello %s', 'world')
|
||||||
|
self.assertEqual(['check: hello world'], self.get_logs())
|
||||||
|
cmd.warn('hello %s %s', 'beautiful', 'world')
|
||||||
|
self.assertEqual(['check: hello beautiful world'], self.get_logs())
|
||||||
|
|
||||||
|
|
||||||
def test_suite():
|
def test_suite():
|
||||||
return unittest.makeSuite(CheckTestCase)
|
return unittest.makeSuite(CheckTestCase)
|
||||||
|
|
Loading…
Reference in New Issue