comparison test_pydertron.py @ 31:3897ed8a350d

Added NullFileSystem and test for it.
author Atul Varma <avarma@mozilla.com>
date Mon, 10 May 2010 01:54:59 -0700
parents
children e3fcfa2bf3bc
comparison
equal deleted inserted replaced
30:83104982c815 31:3897ed8a350d
1 import unittest
2 from StringIO import StringIO
3
4 import pydertron
5
6 class PydertronTests(unittest.TestCase):
7 def testNullFilesystem(self):
8 stderr = StringIO()
9 sandbox = pydertron.JsSandbox(pydertron.NullFileSystem())
10 sandbox.set_globals()
11 sandbox.run_script("require('hi');", stderr=stderr)
12 self.assertEqual(stderr.getvalue(),
13 'Traceback (most recent call last):\n'
14 ' File "<string>", line 1, in <module>\n'
15 'Module not found: hi\n')
16
17 if __name__ == '__main__':
18 unittest.main()