summaryrefslogtreecommitdiff
path: root/tests/test_api.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2022-02-06 11:21:03 -0500
committerNed Batchelder <ned@nedbatchelder.com>2022-02-06 11:22:50 -0500
commitfe6764399e9e2d12d60384685fd1da4449862091 (patch)
tree9f30c3f12678df66042df39cf21ac410e733f33d /tests/test_api.py
parent1ea400ed8b373050c93ef8f46f526d56f250643d (diff)
downloadpython-coveragepy-git-fe6764399e9e2d12d60384685fd1da4449862091.tar.gz
test: SQLite errors come in a few forms
Diffstat (limited to 'tests/test_api.py')
-rw-r--r--tests/test_api.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/test_api.py b/tests/test_api.py
index 4c0fe66c..bc2d05f6 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -26,6 +26,7 @@ from tests.coveragetest import CoverageTest, TESTS_DIR, UsingModulesMixin
from tests.helpers import assert_count_equal, assert_coverage_warnings
from tests.helpers import change_dir, nice_file, os_sep
+BAD_SQLITE_REGEX = r"file( is encrypted or)? is not a database"
class ApiTest(CoverageTest):
"""Api-oriented tests for coverage.py."""
@@ -422,7 +423,7 @@ class ApiTest(CoverageTest):
self.make_file(".coverage.foo", """La la la, this isn't coverage data!""")
cov = coverage.Coverage()
warning_regex = (
- r"Couldn't use data file '.*\.coverage\.foo': file is not a database"
+ r"Couldn't use data file '.*\.coverage\.foo': " + BAD_SQLITE_REGEX
)
with self.assert_warnings(cov, [warning_regex]):
cov.combine()
@@ -1304,7 +1305,7 @@ class CombiningTest(CoverageTest):
assert_coverage_warnings(
warns,
re.compile(
- r"Couldn't use data file '.*[/\\]\.coverage\.bad': file is not a database"
+ r"Couldn't use data file '.*[/\\]\.coverage\.bad': " + BAD_SQLITE_REGEX
),
)
@@ -1335,7 +1336,7 @@ class CombiningTest(CoverageTest):
cov.combine(strict=True)
warn_rx = re.compile(
- r"Couldn't use data file '.*[/\\]\.coverage\.bad[12]': file is not a database"
+ r"Couldn't use data file '.*[/\\]\.coverage\.bad[12]': " + BAD_SQLITE_REGEX
)
assert_coverage_warnings(warns, warn_rx, warn_rx)