# HG changeset patch # User Atul Varma # Date 1273550142 25200 # Node ID 056025f2c8ae1294acbe4ee7940f1b00258cdba3 # Parent e3fcfa2bf3bc0ea3059cbadf9ede17a3b1f89a9a Added GC test diff -r e3fcfa2bf3bc -r 056025f2c8ae test_pydertron.py --- 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()