view 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
line wrap: on
line source

import unittest
from StringIO import StringIO

import pydertron

class PydertronTests(unittest.TestCase):
    def testNullFilesystem(self):
        stderr = StringIO()
        sandbox = pydertron.JsSandbox(pydertron.NullFileSystem())
        sandbox.set_globals()
        sandbox.run_script("require('hi');", stderr=stderr)
        self.assertEqual(stderr.getvalue(),
                         'Traceback (most recent call last):\n'
                         '  File "<string>", line 1, in <module>\n'
                         'Module not found: hi\n')

if __name__ == '__main__':
    unittest.main()