Kaydet (Commit) cb18d077 authored tarafından Éric Araujo's avatar Éric Araujo

Enable catching WARN-level logging messages in distutils' test_sdist

üst b71c15d4
...@@ -85,9 +85,6 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -85,9 +85,6 @@ class SDistTestCase(PyPIRCCommandTestCase):
dist.include_package_data = True dist.include_package_data = True
cmd = sdist(dist) cmd = sdist(dist)
cmd.dist_dir = 'dist' cmd.dist_dir = 'dist'
def _warn(*args):
pass
cmd.warn = _warn
return dist, cmd return dist, cmd
@unittest.skipUnless(zlib, "requires zlib") @unittest.skipUnless(zlib, "requires zlib")
...@@ -242,7 +239,8 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -242,7 +239,8 @@ class SDistTestCase(PyPIRCCommandTestCase):
# with the `check` subcommand # with the `check` subcommand
cmd.ensure_finalized() cmd.ensure_finalized()
cmd.run() cmd.run()
warnings = self.get_logs(WARN) warnings = [msg for msg in self.get_logs(WARN) if
msg.startswith('warning: check:')]
self.assertEqual(len(warnings), 2) self.assertEqual(len(warnings), 2)
# trying with a complete set of metadata # trying with a complete set of metadata
...@@ -251,7 +249,8 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -251,7 +249,8 @@ class SDistTestCase(PyPIRCCommandTestCase):
cmd.ensure_finalized() cmd.ensure_finalized()
cmd.metadata_check = 0 cmd.metadata_check = 0
cmd.run() cmd.run()
warnings = self.get_logs(WARN) warnings = [msg for msg in self.get_logs(WARN) if
msg.startswith('warning: check:')]
self.assertEqual(len(warnings), 0) self.assertEqual(len(warnings), 0)
def test_check_metadata_deprecated(self): def test_check_metadata_deprecated(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment