[Zope3-checkins] CVS: Zope3/src/zodb/code/tests - test_module.py:1.6

Jeremy Hylton jeremy@zope.com
Wed, 15 Jan 2003 15:06:31 -0500


Update of /cvs-repository/Zope3/src/zodb/code/tests
In directory cvs.zope.org:/tmp/cvs-serv29351/tests

Modified Files:
	test_module.py 
Log Message:
If something goes wrong creating a module, unregister it.


=== Zope3/src/zodb/code/tests/test_module.py 1.5 => 1.6 ===
--- Zope3/src/zodb/code/tests/test_module.py:1.5	Wed Jan 15 14:54:12 2003
+++ Zope3/src/zodb/code/tests/test_module.py	Wed Jan 15 15:05:59 2003
@@ -55,9 +55,12 @@
             return x + y + z
         return x + y
     return g
+"""
 
+nested_err_src = nested_src + """\
 g = f(3)
 """
+
 closure_src = """\
 def f(x):
     def g(y):
@@ -229,7 +232,13 @@
 
     def testNested(self):
         self.assertRaises(TypeError,
-                          self.registry.newModule, "nested", nested_src)
+                          self.registry.newModule, "nested", nested_err_src)
+        print self.registry._mgrs
+        self.registry.newModule("nested", nested_src)
+        get_transaction().commit()
+        import nested
+        g = nested.f(3)
+        self.assertEqual(g(4), 7)
 
     def testLambda(self):
         # test a lambda that contains another lambda as a default