Make error messages more helpful

This commit is contained in:
Benjamin Peterson 2008-05-12 22:26:05 +00:00
parent e1b93f2855
commit ab1fb9f728
1 changed files with 5 additions and 2 deletions

View File

@ -157,10 +157,13 @@ class TestStdlibRemovals(unittest.TestCase):
try:
__import__(module_name, level=0)
except DeprecationWarning as exc:
self.assert_(module_name in exc.args[0])
self.assert_(module_name in exc.args[0],
"%s warning didn't contain module name"
% module_name)
except ImportError:
if not optional:
raise
self.fail("Non-optional module %s raised an "
"ImportError." % module_name)
else:
self.fail("DeprecationWarning not raised for %s" %
module_name)