本文整理汇总了Python中ptah.config.cleanup_system函数的典型用法代码示例。如果您正苦于以下问题:Python cleanup_system函数的具体用法?Python cleanup_system怎么用?Python cleanup_system使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cleanup_system函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_adapter_reinitialize
def test_adapter_reinitialize(self):
global testAdapter
@config.adapter(IContext)
@config.adapter(IContext2)
@interface.implementer(IAdapter)
def testAdapter(context): # pragma: no cover
pass
self._init_ptah()
# reinstall
config.cleanup_system()
sm = config.registry
sm.__init__('base')
self._init_ptah(newReg=config.registry)
adapters = sm.adapters.lookupAll((IContext,), IAdapter)
self.assertTrue(len(adapters) == 1)
self.assertTrue(adapters[0][1] is testAdapter)
adapters = sm.adapters.lookupAll((IContext2,), IAdapter)
self.assertTrue(len(adapters) == 1)
self.assertTrue(adapters[0][1] is testAdapter)
示例2: tearDown
def tearDown(self):
config.cleanup_system()
sm = self.p_config
sm.__init__('base')
testing.tearDown()
Session = sqlahelper.get_session()
Session.expunge_all()
示例3: tearDown
def tearDown(self):
config.cleanup_system(self.__class__.__module__)
global TestClass, testAdapter, testHandler
try:
del TestClass
except:
pass
try:
del testAdapter
except:
pass
try:
del testHandler
except:
pass
示例4: test_renderer_tmpl_with_layout
def test_renderer_tmpl_with_layout(self):
class Layout(view.Layout):
def render(self, content):
return '<html>%s</html>'%content
view.register_layout('test', klass=Layout)
self._init_ptah()
def viewFactory(context, request):
return None, {}
# renderer layout is different
r = Renderer(view.template('templates/test.pt'), '')
res = r(Context(), self.request, viewFactory)
self.assertEqual(res.body.strip(), '<div>My snippet</div>')
# layout is 'test'
config.cleanup_system()
r = Renderer(view.template('templates/test.pt'), 'test')
res = r(Context(), self.request, viewFactory)
self.assertEqual(''.join(res.body.split()), '<html><div>Mysnippet</div></html>')
示例5: test_subscriber_reinitialize
def test_subscriber_reinitialize(self):
global testSubscriber
events = []
@config.subscriber(IContext)
def testSubscriber(*args):
events.append(args)
self._init_ptah()
# reinstall
config.cleanup_system()
sm = config.registry
sm.__init__('base')
self._init_ptah()
sm = config.registry
sm.subscribers((Context(IContext),), None)
self.assertTrue(len(events) == 1)
示例6: test_adapts_reinitialize
def test_adapts_reinitialize(self):
global TestClass
class TestClass(object):
config.adapter(IContext)
interface.implements(IAdapter)
self._init_ptah()
# reinstall
config.cleanup_system()
sm = config.registry
sm.__init__('base')
adapters = sm.adapters.lookupAll((IContext,), IAdapter)
self.assertTrue(len(adapters) == 0)
self._init_ptah()
sm = config.registry
adapters = sm.adapters.lookupAll((IContext,), IAdapter)
self.assertTrue(len(adapters) == 1)
self.assertTrue(adapters[0][1] is TestClass)
示例7: tearDown
def tearDown(self):
config.cleanup_system(self.__class__.__module__)
super(TestAppSharingForm, self).tearDown()
示例8: tearDown
def tearDown(self):
config.cleanup_system(self.__class__.__module__)
super(TestPasswordChangerDecl, self).tearDown()
示例9: tearDown
def tearDown(self):
config.cleanup_system(self.__class__.__module__)
super(TestAuthentication, self).tearDown()
示例10: tearDown
def tearDown(self):
config.cleanup_system(self.__class__.__module__)
super(TestSecurityInit, self).tearDown()
示例11: tearDown
def tearDown(self):
config.cleanup_system(self.__class__.__module__)
super(TestExceptions, self).tearDown()
示例12: tearDown
def tearDown(self):
config.cleanup_system(self.__class__.__module__)
示例13: tearDown
def tearDown(self):
config.cleanup_system(self.__class__.__module__)
self.stdout = self._stdout
shutil.rmtree(self.dir)
示例14: setUp
def setUp(self):
config.cleanup_system()
BaseTesting.setUp(self)
self.dir = tempfile.mkdtemp()
示例15: tearDown
def tearDown(self):
config.cleanup_system(self.__class__.__module__)
super(TestContent, self).tearDown()