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

Method test_dash_m_bad_pyc

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

Source from the content-addressed store, hash-verified

486 self.assertNotIn(b'Traceback', err)
487
488 def test_dash_m_bad_pyc(self):
489 with os_helper.temp_dir() as script_dir, \
490 os_helper.change_cwd(path=script_dir):
491 os.mkdir('test_pkg')
492 # Create invalid *.pyc as empty file
493 with open('test_pkg/__init__.pyc', 'wb'):
494 pass
495 err = self.check_dash_m_failure('test_pkg')
496 self.assertRegex(err,
497 br'Error while finding module specification.*'
498 br'ImportError.*bad magic number')
499 self.assertNotIn(b'is a package', err)
500 self.assertNotIn(b'Traceback', err)
501
502 def test_hint_when_triying_to_import_a_py_file(self):
503 with os_helper.temp_dir() as script_dir, \

Callers

nothing calls this directly

Calls 6

check_dash_m_failureMethod · 0.95
temp_dirMethod · 0.80
assertRegexMethod · 0.80
assertNotInMethod · 0.80
openFunction · 0.50
mkdirMethod · 0.45

Tested by

no test coverage detected