bpo-43265: Improve sqlite3.Connection.backup error handling (GH-24586)

This commit is contained in:
Erlend Egeberg Aasland 2021-04-14 13:45:49 +02:00 committed by GitHub
parent b8509ffa82
commit c1ae741997
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 57 deletions

View file

@ -149,10 +149,7 @@ class BackupTests(unittest.TestCase):
with self.assertRaises(sqlite.OperationalError) as cm:
with sqlite.connect(':memory:') as bck:
self.cx.backup(bck, name='non-existing')
self.assertIn(
str(cm.exception),
['SQL logic error', 'SQL logic error or missing database']
)
self.assertIn("unknown database", str(cm.exception))
self.cx.execute("ATTACH DATABASE ':memory:' AS attached_db")
self.cx.execute('CREATE TABLE attached_db.foo (key INTEGER)')