mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-105539: Emit ResourceWarning if sqlite3 database is not closed explicitly (#108015)
This commit is contained in:
parent
86617518c4
commit
1a1bfc2891
5 changed files with 30 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue