(self, exctype, msg, script)
| 898 | os.close(w) |
| 899 | |
| 900 | def _assert_run_failed(self, exctype, msg, script): |
| 901 | if isinstance(exctype, str): |
| 902 | exctype_name = exctype |
| 903 | exctype = None |
| 904 | else: |
| 905 | exctype_name = exctype.__name__ |
| 906 | |
| 907 | # Run the script. |
| 908 | excinfo = self.run_script(script, fails=True) |
| 909 | |
| 910 | # Check the wrapper exception. |
| 911 | self.assertEqual(excinfo.type.__name__, exctype_name) |
| 912 | if msg is None: |
| 913 | self.assertEqual(excinfo.formatted.split(':')[0], |
| 914 | exctype_name) |
| 915 | else: |
| 916 | self.assertEqual(excinfo.formatted, |
| 917 | '{}: {}'.format(exctype_name, msg)) |
| 918 | |
| 919 | return excinfo |
| 920 | |
| 921 | def assert_run_failed(self, exctype, script): |
| 922 | self._assert_run_failed(exctype, None, script) |
no test coverage detected