예제 #1
0
 def testModule(self):
     self.registry.newModule("pmtest", open(self._pmtest).read())
     transaction.commit()
     self.assert_(self.registry.findModule("pmtest"))
     import pmtest
     pmtest._p_deactivate()
     self.assertEqual(pmtest.a, 1)
     pmtest.f(4)
     self.useNewConnection()
예제 #2
0
 def testModuleReload(self):
     self.registry.newModule("pmtest", open(self._pmtest).read())
     transaction.commit()
     import pmtest
     pmtest._p_deactivate()
     self.assertEqual(pmtest.a, 1)
     pmtest.f(4)
     self.close()
     pmtest._p_deactivate()
     self.open()
     del pmtest
     import pmtest
예제 #3
0
 def testUpdateFunction(self):
     self.registry.newModule("pmtest", "def f(x): return x")
     transaction.commit()
     import pmtest
     self.assertEqual(pmtest.f(3), 3)
     copy = pmtest.f
     self.registry.updateModule("pmtest", "def f(x): return x + 1")
     transaction.commit()
     pmtest._p_deactivate()
     self.assertEqual(pmtest.f(3), 4)
     self.assertEqual(copy(3), 4)
     self.useNewConnection()