[pypy-svn] r34221 - pypy/branch/refactor-file/lib-python/modified-2.4.1/test

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Nov 5 12:13:10 CET 2006


Author: cfbolz
Date: Sun Nov  5 12:13:09 2006
New Revision: 34221

Modified:
   pypy/branch/refactor-file/lib-python/modified-2.4.1/test/test_file.py
Log:
weakrefs are working nowadays


Modified: pypy/branch/refactor-file/lib-python/modified-2.4.1/test/test_file.py
==============================================================================
--- pypy/branch/refactor-file/lib-python/modified-2.4.1/test/test_file.py	(original)
+++ pypy/branch/refactor-file/lib-python/modified-2.4.1/test/test_file.py	Sun Nov  5 12:13:09 2006
@@ -1,24 +1,26 @@
 import sys
 import os
+import gc
 from array import array
-#from weakref import proxy
+from weakref import proxy
 
 from test.test_support import verify, TESTFN, TestFailed
 from UserList import UserList
 
-# # verify weak references
-# f = file(TESTFN, 'w')
-# p = proxy(f)
-# p.write('teststring')
-# verify(f.tell(), p.tell())
-# f.close()
-# f = None
-# try:
-#     p.tell()
-# except ReferenceError:
-#     pass
-# else:
-#     raise TestFailed('file proxy still exists when the file is gone')
+# verify weak references
+f = file(TESTFN, 'w')
+p = proxy(f)
+p.write('teststring')
+verify(f.tell(), p.tell())
+f.close()
+f = None
+gc.collect()
+try:
+    p.tell()
+except ReferenceError:
+    pass
+else:
+    raise TestFailed('file proxy still exists when the file is gone')
 
 # verify expected attributes exist
 f = file(TESTFN, 'w')



More information about the Pypy-commit mailing list