(self, script_exec_args, expected_msg,
*cmd_line_switches, cwd=None, **env_vars)
| 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__)") |
no test coverage detected