|
26 | 26 | from tests.helpers import assert_count_equal, assert_coverage_warnings
|
27 | 27 | from tests.helpers import change_dir, nice_file, os_sep
|
28 | 28 |
|
| 29 | +BAD_SQLITE_REGEX = r"file( is encrypted or)? is not a database" |
29 | 30 |
|
30 | 31 | class ApiTest(CoverageTest):
|
31 | 32 | """Api-oriented tests for coverage.py."""
|
@@ -422,7 +423,7 @@ def test_combining_corrupt_data(self):
|
422 | 423 | self.make_file(".coverage.foo", """La la la, this isn't coverage data!""")
|
423 | 424 | cov = coverage.Coverage()
|
424 | 425 | 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 |
426 | 427 | )
|
427 | 428 | with self.assert_warnings(cov, [warning_regex]):
|
428 | 429 | cov.combine()
|
@@ -1304,7 +1305,7 @@ def test_combine_parallel_data_with_a_corrupt_file(self):
|
1304 | 1305 | assert_coverage_warnings(
|
1305 | 1306 | warns,
|
1306 | 1307 | 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 |
1308 | 1309 | ),
|
1309 | 1310 | )
|
1310 | 1311 |
|
@@ -1335,7 +1336,7 @@ def test_combine_no_usable_files(self):
|
1335 | 1336 | cov.combine(strict=True)
|
1336 | 1337 |
|
1337 | 1338 | 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 |
1339 | 1340 | )
|
1340 | 1341 | assert_coverage_warnings(warns, warn_rx, warn_rx)
|
1341 | 1342 |
|
|
0 commit comments