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

Method _check_import_error

Lib/test/test_cmd_line_script.py:137–151  ·  view source on GitHub ↗
(self, script_exec_args, expected_msg,
                            *cmd_line_switches, cwd=None, **env_vars)

Source from the content-addressed store, hash-verified

135 expected_package, expected_loader, cwd)
136
137 def _check_import_error(self, script_exec_args, expected_msg,
138 *cmd_line_switches, cwd=None, **env_vars):
139 if isinstance(script_exec_args, str):
140 script_exec_args = (script_exec_args,)
141 else:
142 script_exec_args = tuple(script_exec_args)
143 run_args = cmd_line_switches + script_exec_args
144 rc, out, err = assert_python_failure(
145 *run_args, __isolated=False, __cwd=cwd, **env_vars
146 )
147 if verbose > 1:
148 print(f'Output from test script {script_exec_args!r:}')
149 print(repr(err))
150 print('Expected output: %r' % expected_msg)
151 self.assertIn(expected_msg.encode('utf-8'), err)
152
153 def test_dash_c_loader(self):
154 rc, out, err = assert_python_ok("-c", "print(__loader__)")

Callers 4

test_directory_errorMethod · 0.95
test_zipfile_errorMethod · 0.95
test_package_errorMethod · 0.95

Calls 3

assert_python_failureFunction · 0.90
assertInMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected