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


Python ConfigurationMachine.includepath方法代码示例

本文整理汇总了Python中zope.configuration.config.ConfigurationMachine.includepath方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigurationMachine.includepath方法的具体用法?Python ConfigurationMachine.includepath怎么用?Python ConfigurationMachine.includepath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在zope.configuration.config.ConfigurationMachine的用法示例。


在下文中一共展示了ConfigurationMachine.includepath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_actions_have_parents_includepath

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import includepath [as 别名]
 def test_actions_have_parents_includepath(self):
     from zope.configuration import xmlconfig
     from zope.configuration.config import ConfigurationMachine
     from zope.configuration.xmlconfig import registerCommonDirectives
     from zope.configuration import tests
     from zope.configuration.tests import simple
     context = ConfigurationMachine()
     fqp = _packageFile(tests, 'configure.zcml')
     registerCommonDirectives(context)
     before_stack = context.stack[:]
     context.package = tests
     # dummy action, path from "previous" include
     context.includepath = (fqp,)
     def _callable():
         raise AssertionError("should not be called")
     context.actions.append({'discriminator': None,
                             'callable': _callable,
                            })
     fqn = _packageFile(tests, 'simple.zcml')
     logger = LoggerStub()
     with _Monkey(xmlconfig, logger=logger):
         self._callFUT(context, 'simple.zcml')
     self.assertEqual(len(logger.debugs), 1)
     self.assertEqual(logger.debugs[0], ('include %s', (fqn,), {}))
     self.assertEqual(len(context.actions), 4)
     action = context.actions[0]
     self.assertEqual(action['discriminator'], None)
     self.assertEqual(action['callable'], _callable)
     action = context.actions[1]
     self.assertEqual(action['callable'], simple.file_registry.append)
     self.assertEqual(action['includepath'], (fqp,))
     self.assertEqual(action['args'][0].path,
                      _packageFile(tests, 'simple.py'))
     action = context.actions[2]
     self.assertEqual(action['callable'], simple.file_registry.append)
     self.assertEqual(action['includepath'], (fqp,))
     self.assertEqual(action['args'][0].path,
                      _packageFile(tests, 'simple.zcml'))
     action = context.actions[3]
     self.assertEqual(action['callable'], simple.file_registry.append)
     self.assertEqual(action['includepath'], (fqp,))
     self.assertEqual(action['args'][0].path,
                      _packageFile(tests, '__init__.py'))
     self.assertEqual(context.stack, before_stack)
     self.assertEqual(len(context._seen_files), 1)
     self.assertIn(fqn, context._seen_files)
开发者ID:zopefoundation,项目名称:zope.configuration,代码行数:48,代码来源:test_xmlconfig.py


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