Mercurial > pymonkey
diff test_pymonkey.py @ 87:345d4c0e3dd3
Thread safety exceptions are now properly raised by all relevant pymonkey functions.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sun, 09 Aug 2009 16:17:25 -0700 |
parents | 16a3e99e9b77 |
children | 0b2970e8cd67 |
line wrap: on
line diff
--- a/test_pymonkey.py Sun Aug 09 15:46:40 2009 -0700 +++ b/test_pymonkey.py Sun Aug 09 16:17:25 2009 -0700 @@ -31,6 +31,18 @@ was_raised = True self.assertTrue(was_raised) + def testThreadSafetyExceptionIsRaised(self): + stuff = {} + def make_runtime(): + stuff['rt'] = pymonkey.Runtime() + thread = threading.Thread(target = make_runtime) + thread.start() + thread.join() + self.assertRaises(pymonkey.error, + stuff['rt'].new_context) + self.assertEqual(self.last_exception.message, + 'Function called from wrong thread') + def testClearObjectPrivateWorks(self): class Foo(object): pass