(self)
| 177 | |
| 178 | @force_not_colorized |
| 179 | def test_excepthook_bytes_filename(self): |
| 180 | # bpo-37467: sys.excepthook() must not crash if a filename |
| 181 | # is a bytes string |
| 182 | with warnings.catch_warnings(): |
| 183 | warnings.simplefilter('ignore', BytesWarning) |
| 184 | |
| 185 | try: |
| 186 | raise SyntaxError("msg", (b"bytes_filename", 123, 0, "text")) |
| 187 | except SyntaxError as exc: |
| 188 | with support.captured_stderr() as err: |
| 189 | sys.__excepthook__(*sys.exc_info()) |
| 190 | |
| 191 | err = err.getvalue() |
| 192 | self.assertIn(""" File "b'bytes_filename'", line 123\n""", err) |
| 193 | self.assertIn(""" text\n""", err) |
| 194 | self.assertEndsWith(err, "SyntaxError: msg\n") |
| 195 | |
| 196 | def test_excepthook(self): |
| 197 | with test.support.captured_output("stderr") as stderr: |
nothing calls this directly
no test coverage detected