(
self,
msg,
err_type,
no_error_msg="Failed to generate error"
)
| 174 | |
| 175 | # Helper function mimicking pytest.raises for subprocess call |
| 176 | def _expect_error( |
| 177 | self, |
| 178 | msg, |
| 179 | err_type, |
| 180 | no_error_msg="Failed to generate error" |
| 181 | ): |
| 182 | try: |
| 183 | self._run() |
| 184 | except subprocess.CalledProcessError as e: |
| 185 | assertion_message = f"Expected: {msg}\nGot: {e.stderr}" |
| 186 | assert re.search(msg, e.stderr), assertion_message |
| 187 | |
| 188 | assertion_message = ( |
| 189 | f"Expected error of type: {err_type}; see full " |
| 190 | f"error:\n{e.stderr}" |
| 191 | ) |
| 192 | assert re.search(err_type, e.stderr), assertion_message |
| 193 | else: |
| 194 | assert False, no_error_msg |
| 195 | |
| 196 | def setup_method(self): |
| 197 | """Ensure that the environment is reset""" |
no test coverage detected