]> granicus.if.org Git - python/commitdiff
Silence BytesWarning (backport 267a4d4d9d65).
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 6 Feb 2014 22:26:57 +0000 (00:26 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 6 Feb 2014 22:26:57 +0000 (00:26 +0200)
Lib/test/test_exceptions.py

index fe660bf9b4515d76c812e1624bba4b77e554300d..43fc7ee9c6fd5c681bd621e54f498e32ab67f19d 100644 (file)
@@ -8,8 +8,8 @@ import weakref
 import errno
 
 from test.support import (TESTFN, captured_output, check_impl_detail,
-                          cpython_only, gc_collect, run_unittest, no_tracing,
-                          unlink)
+                          check_warnings, cpython_only, gc_collect,
+                          no_tracing, run_unittest, unlink)
 
 class NaiveException(Exception):
     def __init__(self, x):
@@ -960,9 +960,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():