|
5 | 5 |
|
6 | 6 | from __future__ import annotations |
7 | 7 |
|
8 | | -from typing import NoReturn |
9 | 8 | from unittest import mock |
10 | 9 |
|
11 | 10 | import pytest |
12 | 11 |
|
13 | | -import coverage.sqlitedb |
14 | 12 | from coverage.exceptions import DataError |
15 | 13 | from coverage.sqlitedb import SqliteDb |
16 | 14 |
|
@@ -77,16 +75,10 @@ def test_retry_executemany_void_failure(self) -> None: |
77 | 75 |
|
78 | 76 | def test_open_fails_on_bad_db(self) -> None: |
79 | 77 | self.make_file("bad.db", "boogers") |
80 | | - |
81 | | - def fake_failing_open(filename: str, mode: str) -> NoReturn: |
82 | | - assert (filename, mode) == ("bad.db", "rb") |
83 | | - raise RuntimeError("No you can't!") |
84 | | - |
85 | | - with mock.patch.object(coverage.sqlitedb, "open", fake_failing_open): |
86 | | - msg = "Couldn't use data file 'bad.db': file is not a database" |
87 | | - with pytest.raises(DataError, match=msg): |
88 | | - with SqliteDb("bad.db", DebugControlString(options=["sql"])): |
89 | | - pass # pragma: not covered |
| 78 | + msg = "Couldn't use data file 'bad.db': file is not a database" |
| 79 | + with pytest.raises(DataError, match=msg): |
| 80 | + with SqliteDb("bad.db", DebugControlString(options=["sql"])): |
| 81 | + pass # pragma: not covered |
90 | 82 |
|
91 | 83 | def test_execute_void_can_allow_failure(self) -> None: |
92 | 84 | with SqliteDb("fail.db", DebugControlString(options=["sql"])) as db: |
|
0 commit comments