当前位置: 首页>>代码示例>>Python>>正文


Python config.cleanup_system函数代码示例

本文整理汇总了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)
开发者ID:blaflamme,项目名称:ptah,代码行数:28,代码来源:test_directives.py

示例2: tearDown

    def tearDown(self):
        config.cleanup_system()
        sm = self.p_config
        sm.__init__('base')
        testing.tearDown()

        Session = sqlahelper.get_session()
        Session.expunge_all()
开发者ID:blaflamme,项目名称:ptah,代码行数:8,代码来源:base.py

示例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
开发者ID:blaflamme,项目名称:ptah,代码行数:16,代码来源:test_directives.py

示例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>')
开发者ID:mcdonc,项目名称:ptah,代码行数:21,代码来源:test_renderers.py

示例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)
开发者ID:blaflamme,项目名称:ptah,代码行数:22,代码来源:test_directives.py

示例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)
开发者ID:blaflamme,项目名称:ptah,代码行数:24,代码来源:test_directives.py

示例7: tearDown

 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestAppSharingForm, self).tearDown()
开发者ID:WouterVH,项目名称:ptah,代码行数:3,代码来源:test_apps.py

示例8: tearDown

 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestPasswordChangerDecl, self).tearDown()
开发者ID:mcdonc,项目名称:ptah,代码行数:3,代码来源:test_password.py

示例9: tearDown

 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestAuthentication, self).tearDown()
开发者ID:WouterVH,项目名称:ptah,代码行数:3,代码来源:test_auth.py

示例10: tearDown

 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestSecurityInit, self).tearDown()
开发者ID:blaflamme,项目名称:ptah,代码行数:3,代码来源:test_srvinit.py

示例11: tearDown

 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestExceptions, self).tearDown()
开发者ID:blaflamme,项目名称:ptah,代码行数:3,代码来源:test_exc.py

示例12: tearDown

 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
开发者ID:blaflamme,项目名称:ptah,代码行数:2,代码来源:test_command.py

示例13: tearDown

    def tearDown(self):
        config.cleanup_system(self.__class__.__module__)

        self.stdout = self._stdout
        shutil.rmtree(self.dir)
开发者ID:WouterVH,项目名称:ptah,代码行数:5,代码来源:test_commands.py

示例14: setUp

 def setUp(self):
     config.cleanup_system()
     BaseTesting.setUp(self)
     self.dir = tempfile.mkdtemp()
开发者ID:blaflamme,项目名称:ptah,代码行数:4,代码来源:test_settings.py

示例15: tearDown

 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestContent, self).tearDown()
开发者ID:WouterVH,项目名称:ptah,代码行数:3,代码来源:test_content.py


注:本文中的ptah.config.cleanup_system函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。