(self)
| 925 | self._assert_run_failed(exctype, msg, script) |
| 926 | |
| 927 | def test_exit(self): |
| 928 | with self.subTest('sys.exit(0)'): |
| 929 | # XXX Should an unhandled SystemExit(0) be handled as not-an-error? |
| 930 | self.assert_run_failed(SystemExit, """ |
| 931 | sys.exit(0) |
| 932 | """) |
| 933 | |
| 934 | with self.subTest('sys.exit()'): |
| 935 | self.assert_run_failed(SystemExit, """ |
| 936 | import sys |
| 937 | sys.exit() |
| 938 | """) |
| 939 | |
| 940 | with self.subTest('sys.exit(42)'): |
| 941 | self.assert_run_failed_msg(SystemExit, '42', """ |
| 942 | import sys |
| 943 | sys.exit(42) |
| 944 | """) |
| 945 | |
| 946 | with self.subTest('SystemExit'): |
| 947 | self.assert_run_failed_msg(SystemExit, '42', """ |
| 948 | raise SystemExit(42) |
| 949 | """) |
| 950 | |
| 951 | # XXX Also check os._exit() (via a subprocess)? |
| 952 | |
| 953 | def test_plain_exception(self): |
| 954 | self.assert_run_failed_msg(Exception, 'spam', """ |
nothing calls this directly
no test coverage detected