def test_runtime_recursion_that_is_totally_our_fault(self):
"""
If stuff does blow up, don't blame the wrong party if we can
help it.
"""
from calmjs.testing import utils
stub_stdouts(self)
# We kind of have to punt this, so punt it with a stupid
# override using an EntryPoint that explodes.
class TrulyBadAtInit(runtime.Runtime):
def init_argparser(self, argparser):
raise RuntimeError('maximum recursion depth exceeded')
def cleanup():
del utils.trulybad
self.addCleanup(cleanup)
make_dummy_dist(self, ((
'entry_points.txt',
'[calmjs.runtime]\n'
'trulybad = calmjs.testing.utils:trulybad\n'
),), 'example.badsimple', '1.0')
working_set = pkg_resources.WorkingSet([self._calmjs_testing_tmpdir])
utils.trulybad = TrulyBadAtInit(None)
with pretty_logging(
logger='calmjs.runtime', stream=mocks.StringIO()) as s:
runtime.Runtime(working_set=working_set).argparser
self.assertIn("maximum recursion depth exceeded", s.getvalue())
评论列表
文章目录