def test_duplication_and_runtime_not_recursion(self):
"""
Make sure it explodes normally if standard runtime error.
"""
from calmjs.testing import utils
class BadAtInit(runtime.DriverRuntime):
def init_argparser(self, argparser):
if argparser is not self.argparser:
raise RuntimeError('A fake explosion')
def cleanup():
del utils.badatinit
self.addCleanup(cleanup)
stub_stdouts(self)
# create a dummy dist
make_dummy_dist(self, ((
'entry_points.txt',
'[calmjs.runtime]\n'
'badatinit = calmjs.testing.utils:badatinit\n'
),), 'example.badsimple', '1.0')
working_set = pkg_resources.WorkingSet([self._calmjs_testing_tmpdir])
utils.badatinit = BadAtInit(None)
# and here lies the crimson magician, all out of hp.
with pretty_logging(
logger='calmjs.runtime', stream=mocks.StringIO()) as s:
runtime.Runtime(working_set=working_set).argparser
self.assertIn(
"cannot register entry_point "
"'badatinit = calmjs.testing.utils:badatinit' from "
"'example.badsimple 1.0' ", s.getvalue()
)
评论列表
文章目录