gh-105539: Emit ResourceWarning if sqlite3 database is not closed explicitly (#108015)

This commit is contained in:
Erlend E. Aasland 2023-08-22 13:10:29 +02:00 committed by GitHub
parent 86617518c4
commit 1a1bfc2891
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 0 deletions

View file

@ -583,6 +583,12 @@ class ConnectionTests(unittest.TestCase):
cx.close()
self.assertEqual(cm.filename, __file__)
def test_connection_resource_warning(self):
with self.assertWarns(ResourceWarning):
cx = sqlite.connect(":memory:")
del cx
gc_collect()
class UninitialisedConnectionTests(unittest.TestCase):
def setUp(self):