Mercurial > pydertron
comparison test_pydertron.py @ 33:056025f2c8ae
Added GC test
| author | Atul Varma <avarma@mozilla.com> |
|---|---|
| date | Mon, 10 May 2010 20:55:42 -0700 |
| parents | e3fcfa2bf3bc |
| children | 739c87de4667 |
comparison
equal
deleted
inserted
replaced
| 32:e3fcfa2bf3bc | 33:056025f2c8ae |
|---|---|
| 1 import unittest | 1 import unittest |
| 2 import weakref | |
| 3 import gc | |
| 2 from StringIO import StringIO | 4 from StringIO import StringIO |
| 3 | 5 |
| 4 import pydertron | 6 import pydertron |
| 5 | 7 |
| 6 class PydertronTests(unittest.TestCase): | 8 class PydertronTests(unittest.TestCase): |
| 13 'Traceback (most recent call last):\n' | 15 'Traceback (most recent call last):\n' |
| 14 ' File "<string>", line 1, in <module>\n' | 16 ' File "<string>", line 1, in <module>\n' |
| 15 'Module not found: hi\n') | 17 'Module not found: hi\n') |
| 16 sandbox.finish() | 18 sandbox.finish() |
| 17 | 19 |
| 20 def testGC(self): | |
| 21 sandbox = pydertron.JsSandbox(pydertron.NullFileSystem()) | |
| 22 wrt = weakref.ref(sandbox.rt) | |
| 23 del sandbox | |
| 24 gc.collect() | |
| 25 self.assertEqual(wrt(), None) | |
| 26 | |
| 18 if __name__ == '__main__': | 27 if __name__ == '__main__': |
| 19 unittest.main() | 28 unittest.main() |
