[Checkins] SVN: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_config.py Full coverage for z.c.config.RootStackItem.
Tres Seaver
cvs-admin at zope.org
Wed May 9 16:19:22 UTC 2012
Log message for revision 125765:
Full coverage for z.c.config.RootStackItem.
Changed:
U zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_config.py
-=-
Modified: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_config.py
===================================================================
--- zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_config.py 2012-05-09 16:19:14 UTC (rev 125764)
+++ zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_config.py 2012-05-09 16:19:19 UTC (rev 125765)
@@ -884,7 +884,6 @@
'order': 0,
}])
- #TODO coverage
class RootStackItemTests(_ConformsToIStackItem,
@@ -900,9 +899,35 @@
context = object()
return self._getTargetClass()(context)
- #TODO coverage
+ def test_contained_context_factory_fails(self):
+ from zope.configuration.exceptions import ConfigurationError
+ class _Context(object):
+ def factory(self, context, name):
+ pass
+ rsi = self._makeOne(_Context())
+ self.assertRaises(ConfigurationError,
+ rsi.contained, ('ns', 'name'), {}, '')
+ def test_contained_context_factory_normal(self):
+ _called_with = []
+ _adapter = object()
+ def _factory(context, data, info):
+ _called_with.append((context, data, info))
+ return _adapter
+ class _Context(object):
+ def factory(self, context, name):
+ return _factory
+ context = _Context()
+ rsi = self._makeOne(context)
+ adapter = rsi.contained(('ns', 'name'), {'a': 'b'}, 'INFO')
+ self.assertTrue(adapter is _adapter)
+ self.assertEqual(_called_with, [(context, {'a': 'b'}, 'INFO')])
+ def test_finish(self):
+ rsi = self._makeOne()
+ rsi.finish() #noraise
+
+
class GroupingStackItemTests(_ConformsToIStackItem,
unittest.TestCase,
):
More information about the checkins
mailing list