@@ -1068,7 +1068,7 @@ def __exit__(self, exc_type, exc_value, traceback):
1068
1068
except Exception as exc :
1069
1069
if self .debug :
1070
1070
self .debug .write (f"EXCEPTION from __exit__: { exc } " )
1071
- raise
1071
+ raise CoverageException ( f"Couldn't end data file { self . filename !r } : { exc } " ) from exc
1072
1072
1073
1073
def execute (self , sql , parameters = ()):
1074
1074
"""Same as :meth:`python:sqlite3.Connection.execute`."""
@@ -1095,7 +1095,7 @@ def execute(self, sql, parameters=()):
1095
1095
"Looks like a coverage 4.x data file. " +
1096
1096
"Are you mixing versions of coverage?"
1097
1097
)
1098
- except Exception :
1098
+ except Exception : # pragma: cant happen
1099
1099
pass
1100
1100
if self .debug :
1101
1101
self .debug .write (f"EXCEPTION from execute: { msg } " )
@@ -1116,7 +1116,7 @@ def execute_one(self, sql, parameters=()):
1116
1116
elif len (rows ) == 1 :
1117
1117
return rows [0 ]
1118
1118
else :
1119
- raise CoverageException (f"Sql { sql !r} shouldn't return { len (rows )} rows" )
1119
+ raise AssertionError (f"SQL { sql !r} shouldn't return { len (rows )} rows" )
1120
1120
1121
1121
def executemany (self , sql , data ):
1122
1122
"""Same as :meth:`python:sqlite3.Connection.executemany`."""
@@ -1125,7 +1125,7 @@ def executemany(self, sql, data):
1125
1125
self .debug .write (f"Executing many { sql !r} with { len (data )} rows" )
1126
1126
try :
1127
1127
return self .con .executemany (sql , data )
1128
- except Exception :
1128
+ except Exception : # pragma: cant happen
1129
1129
# In some cases, an error might happen that isn't really an
1130
1130
# error. Try again immediately.
1131
1131
# https://github.com/nedbat/coveragepy/issues/1010
0 commit comments