Skip to content

Commit c7616ac

Browse files
committed
test: make sqlite fallback test mypyc-safe
1 parent 8893929 commit c7616ac

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

mypy/test/testmetastore.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import tempfile
66
import unittest
7-
from typing import NoReturn
87
from unittest.mock import patch
98

109
from mypy import build
@@ -17,12 +16,12 @@ def test_create_metastore_falls_back_to_filesystem_when_sqlite_missing(self) ->
1716
options = Options()
1817
options.sqlite_cache = True
1918

20-
def missing_sqlite(db_file: str, set_journal_mode: bool) -> NoReturn:
21-
raise ModuleNotFoundError("No module named '_sqlite3'")
22-
2319
with tempfile.TemporaryDirectory() as tmpdir:
2420
options.cache_dir = tmpdir
25-
with patch("mypy.metastore.connect_db", missing_sqlite):
21+
with patch(
22+
"mypy.build.SqliteMetadataStore",
23+
side_effect=ModuleNotFoundError("No module named '_sqlite3'"),
24+
):
2625
store = build.create_metastore(options, parallel_worker=False)
2726

2827
try:

0 commit comments

Comments
 (0)