Skip to content

Commit 04ee0ca

Browse files
committed
test: this test no longer needs a mock
1 parent 1370e4c commit 04ee0ca

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

tests/test_sqlitedb.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55

66
from __future__ import annotations
77

8-
from typing import NoReturn
98
from unittest import mock
109

1110
import pytest
1211

13-
import coverage.sqlitedb
1412
from coverage.exceptions import DataError
1513
from coverage.sqlitedb import SqliteDb
1614

@@ -77,16 +75,10 @@ def test_retry_executemany_void_failure(self) -> None:
7775

7876
def test_open_fails_on_bad_db(self) -> None:
7977
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
9082

9183
def test_execute_void_can_allow_failure(self) -> None:
9284
with SqliteDb("fail.db", DebugControlString(options=["sql"])) as db:

0 commit comments

Comments
 (0)