[Python-checkins] python/dist/src/Lib/test test_descr.py, 1.202.2.1, 1.202.2.2

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Fri Mar 4 05:47:07 CET 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6375/Lib/test

Modified Files:
      Tag: release24-maint
	test_descr.py 
Log Message:
Convert "__init__ should return None" from an exception to a warning.



Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.202.2.1
retrieving revision 1.202.2.2
diff -u -d -r1.202.2.1 -r1.202.2.2
--- test_descr.py	3 Mar 2005 16:55:53 -0000	1.202.2.1
+++ test_descr.py	4 Mar 2005 04:47:04 -0000	1.202.2.2
@@ -3965,17 +3965,23 @@
     import gc; gc.collect()
     vereq(hasattr(c, 'attr'), False)
 
+import warnings
+
 def test_init():
     # SF 1155938
     class Foo(object):
         def __init__(self):
             return 10
+
+    oldfilters = warnings.filters
+    warnings.filterwarnings("error", category=RuntimeWarning)
     try:
         Foo()
-    except TypeError:
+    except RuntimeWarning:
         pass
     else:
         raise TestFailed, "did not test __init__() for None return"
+    warnings.filters = oldfilters
 
 
 def test_main():



More information about the Python-checkins mailing list