MCPcopy Index your code
hub / github.com/python/cpython / test_dash_m_init_traceback

Method test_dash_m_init_traceback

Lib/test/test_cmd_line_script.py:512–524  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

510 b"of 'asyncio.py' as the module name", err)
511
512 def test_dash_m_init_traceback(self):
513 # These were wrapped in an ImportError and tracebacks were
514 # suppressed; see Issue 14285
515 exceptions = (ImportError, AttributeError, TypeError, ValueError)
516 for exception in exceptions:
517 exception = exception.__name__
518 init = "raise {0}('Exception in __init__.py')".format(exception)
519 with self.subTest(exception), \
520 self.setup_test_pkg(init) as pkg_dir:
521 err = self.check_dash_m_failure('test_pkg')
522 self.assertIn(exception.encode('ascii'), err)
523 self.assertIn(b'Exception in __init__.py', err)
524 self.assertIn(b'Traceback', err)
525
526 def test_dash_m_main_traceback(self):
527 # Ensure that an ImportError's traceback is reported

Callers

nothing calls this directly

Calls 6

setup_test_pkgMethod · 0.95
check_dash_m_failureMethod · 0.95
assertInMethod · 0.80
formatMethod · 0.45
subTestMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected