Skip to content

Commit 07a50af

Browse files
committed
Simplify import_driver_module - remove problematic find_spec
1 parent ccc786e commit 07a50af

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

sqlit/db/adapters/base.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
from __future__ import annotations
44

55
import importlib
6-
import importlib.util
7-
import sys
86
from abc import ABC, abstractmethod
97
from dataclasses import dataclass
108
from pathlib import Path
@@ -87,18 +85,6 @@ def import_driver_module(
8785
if not extra_name or not package_name:
8886
return importlib.import_module(module_name)
8987

90-
# Skip find_spec if module is already in sys.modules (allows test mocking)
91-
# find_spec can raise ModuleNotFoundError for submodules like 'mysql.connector'
92-
if module_name not in sys.modules:
93-
try:
94-
spec = importlib.util.find_spec(module_name)
95-
except ModuleNotFoundError:
96-
spec = None
97-
if spec is None:
98-
from ...db.exceptions import MissingDriverError
99-
100-
raise MissingDriverError(driver_name, extra_name, package_name, module_name=module_name)
101-
10288
try:
10389
return importlib.import_module(module_name)
10490
except ImportError as e:

0 commit comments

Comments
 (0)