Skip to content

Commit fe67643

Browse files
committed
test: SQLite errors come in a few forms
1 parent 1ea400e commit fe67643

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/test_api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from tests.helpers import assert_count_equal, assert_coverage_warnings
2727
from tests.helpers import change_dir, nice_file, os_sep
2828

29+
BAD_SQLITE_REGEX = r"file( is encrypted or)? is not a database"
2930

3031
class ApiTest(CoverageTest):
3132
"""Api-oriented tests for coverage.py."""
@@ -422,7 +423,7 @@ def test_combining_corrupt_data(self):
422423
self.make_file(".coverage.foo", """La la la, this isn't coverage data!""")
423424
cov = coverage.Coverage()
424425
warning_regex = (
425-
r"Couldn't use data file '.*\.coverage\.foo': file is not a database"
426+
r"Couldn't use data file '.*\.coverage\.foo': " + BAD_SQLITE_REGEX
426427
)
427428
with self.assert_warnings(cov, [warning_regex]):
428429
cov.combine()
@@ -1304,7 +1305,7 @@ def test_combine_parallel_data_with_a_corrupt_file(self):
13041305
assert_coverage_warnings(
13051306
warns,
13061307
re.compile(
1307-
r"Couldn't use data file '.*[/\\]\.coverage\.bad': file is not a database"
1308+
r"Couldn't use data file '.*[/\\]\.coverage\.bad': " + BAD_SQLITE_REGEX
13081309
),
13091310
)
13101311

@@ -1335,7 +1336,7 @@ def test_combine_no_usable_files(self):
13351336
cov.combine(strict=True)
13361337

13371338
warn_rx = re.compile(
1338-
r"Couldn't use data file '.*[/\\]\.coverage\.bad[12]': file is not a database"
1339+
r"Couldn't use data file '.*[/\\]\.coverage\.bad[12]': " + BAD_SQLITE_REGEX
13391340
)
13401341
assert_coverage_warnings(warns, warn_rx, warn_rx)
13411342

0 commit comments

Comments
 (0)