r"""\i with an os_error returns an error.
(os, executor, pgspecial)
| 286 | @dbtest |
| 287 | @patch("pgcli.main.os") |
| 288 | def test_execute_from_file_io_error(os, executor, pgspecial): |
| 289 | r"""\i with an os_error returns an error.""" |
| 290 | # Inject an OSError. |
| 291 | os.path.expanduser.side_effect = OSError("test") |
| 292 | |
| 293 | # Check the result. |
| 294 | result = list(executor.run(r"\i test", pgspecial=pgspecial)) |
| 295 | status, sql, success, is_special = result[0][3:] |
| 296 | assert status == "test" |
| 297 | assert success is False |
| 298 | assert is_special is True |
| 299 | |
| 300 | |
| 301 | @dbtest |