]> granicus.if.org Git - python/commitdiff
Clean up some warnings in test suite output.
authorNadeem Vawda <nadeem.vawda@gmail.com>
Sat, 13 Oct 2012 23:42:32 +0000 (01:42 +0200)
committerNadeem Vawda <nadeem.vawda@gmail.com>
Sat, 13 Oct 2012 23:42:32 +0000 (01:42 +0200)
Lib/test/test_exceptions.py
Lib/test/test_importlib/import_/test_fromlist.py

index 413f4dd62bc6024b1d6d70013af11c93f12f80dd..8e5a767f8602beb9516d91b3c09f73f47455af8b 100644 (file)
@@ -8,7 +8,7 @@ import weakref
 import errno
 
 from test.support import (TESTFN, unlink, run_unittest, captured_output,
-                          gc_collect, cpython_only, no_tracing)
+                          check_warnings, gc_collect, cpython_only, no_tracing)
 
 class NaiveException(Exception):
     def __init__(self, x):
@@ -939,9 +939,10 @@ class ImportErrorTests(unittest.TestCase):
 
     def test_non_str_argument(self):
         # Issue #15778
-        arg = b'abc'
-        exc = ImportError(arg)
-        self.assertEqual(str(arg), str(exc))
+        with check_warnings(('', BytesWarning), quiet=True):
+            arg = b'abc'
+            exc = ImportError(arg)
+            self.assertEqual(str(arg), str(exc))
 
 
 def test_main():
index 27b227076ea65305e06b645edfb4cda45b3b6176..c16c33710fa0040539f84d49fc02ac1dcce4f622 100644 (file)
@@ -80,7 +80,7 @@ class HandlingFromlist(unittest.TestCase):
             with util.import_state(meta_path=[importer]):
                 with self.assertRaises(ImportError) as exc:
                     import_util.import_('pkg', fromlist=['mod'])
-                self.assertEquals('i_do_not_exist', exc.exception.name)
+                self.assertEqual('i_do_not_exist', exc.exception.name)
 
     def test_empty_string(self):
         with util.mock_modules('pkg.__init__', 'pkg.mod') as importer: