(
self,
msg,
err_type,
no_error_msg="Failed to generate error"
)
| 164 | |
| 165 | # Helper function mimicing pytest.raises for subprocess call |
| 166 | def _expect_error( |
| 167 | self, |
| 168 | msg, |
| 169 | err_type, |
| 170 | no_error_msg="Failed to generate error" |
| 171 | ): |
| 172 | try: |
| 173 | self._run() |
| 174 | except subprocess.CalledProcessError as e: |
| 175 | assertion_message = f"Expected: {msg}\nGot: {e.stderr}" |
| 176 | assert re.search(msg, e.stderr), assertion_message |
| 177 | |
| 178 | assertion_message = ( |
| 179 | f"Expected error of type: {err_type}; see full " |
| 180 | f"error:\n{e.stderr}" |
| 181 | ) |
| 182 | assert re.search(err_type, e.stderr), assertion_message |
| 183 | else: |
| 184 | assert False, no_error_msg |
| 185 | |
| 186 | def setup_method(self): |
| 187 | """Ensure that the environment is reset""" |
no test coverage detected