changeset 33:056025f2c8ae

Added GC test
author Atul Varma <avarma@mozilla.com>
date Mon, 10 May 2010 20:55:42 -0700
parents e3fcfa2bf3bc
children 739c87de4667
files test_pydertron.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test_pydertron.py	Mon May 10 01:55:47 2010 -0700
+++ b/test_pydertron.py	Mon May 10 20:55:42 2010 -0700
@@ -1,4 +1,6 @@
 import unittest
+import weakref
+import gc
 from StringIO import StringIO
 
 import pydertron
@@ -15,5 +17,12 @@
                          'Module not found: hi\n')
         sandbox.finish()
 
+    def testGC(self):
+        sandbox = pydertron.JsSandbox(pydertron.NullFileSystem())
+        wrt = weakref.ref(sandbox.rt)
+        del sandbox
+        gc.collect()
+        self.assertEqual(wrt(), None)
+
 if __name__ == '__main__':
     unittest.main()