Skip to content

Commit df44a58

Browse files
committed
DRYer
1 parent bec4b6d commit df44a58

File tree

1 file changed

+3
-0
lines changed
  • src/calibre/devices/kobo

1 file changed

+3
-0
lines changed

src/calibre/devices/kobo/db.py

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# Any plugins not running in the device thread must acquire this lock before
1515
# trying to access the Kobo database.
1616
kobo_db_lock = RLock()
17+
INJECT_9P_ERROR = False
1718

1819

1920
def row_factory(cursor: apsw.Cursor, row):
@@ -43,6 +44,8 @@ def __init__(self, path_on_device: str):
4344
self.path_on_device = self.dbpath = path_on_device
4445
self.dbversion = 0
4546
def connect(path: str = path_on_device) -> None:
47+
if INJECT_9P_ERROR:
48+
raise apsw.IOError('Fake I/O error to test 9p codepath')
4649
with closing(apsw.Connection(path)) as conn:
4750
conn.setrowtrace(row_factory)
4851
cursor = conn.cursor()

0 commit comments

Comments
 (0)