Skip to content

Commit cb12b7b

Browse files
test: fix dbapi test connection resource warnings
DBAPI2 compliance tests are not implemented here but inherited from external module [1]. Two tests from this module open a connection and forget to close it. The fix [2] has been merged but there is no new tag yet [2]. 1. https://pypi.org/project/dbapi-compliance/ 2. baztian/dbapi-compliance#5 Follows #250
1 parent c6e59f3 commit cb12b7b

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

requirements-test.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
dbapi-compliance==1.15.0
1+
git+https://github.com/baztian/dbapi-compliance.git@ea7cb1b4#egg=dbapi-compliance
22
pyyaml==6.0
33
importlib-metadata >= 1.0 ; python_version < '3.8'

test/suites/test_dbapi.py

-40
Original file line numberDiff line numberDiff line change
@@ -127,43 +127,3 @@ def test_setoutputsize(self): # Do nothing
127127
@unittest.skip('Not implemented')
128128
def test_description(self):
129129
pass
130-
131-
def test_ExceptionsAsConnectionAttributes(self):
132-
# Workaround for https://github.com/baztian/dbapi-compliance/issues/5
133-
134-
# OPTIONAL EXTENSION
135-
# Test for the optional DB API 2.0 extension, where the exceptions
136-
# are exposed as attributes on the Connection object
137-
# I figure this optional extension will be implemented by any
138-
# driver author who is using this test suite, so it is enabled
139-
# by default.
140-
drv = self.driver
141-
con = self._connect()
142-
try:
143-
dbapi20._failUnless(self,con.Warning is drv.Warning)
144-
dbapi20._failUnless(self,con.Error is drv.Error)
145-
dbapi20._failUnless(self,con.InterfaceError is drv.InterfaceError)
146-
dbapi20._failUnless(self,con.DatabaseError is drv.DatabaseError)
147-
dbapi20._failUnless(self,con.OperationalError is drv.OperationalError)
148-
dbapi20._failUnless(self,con.IntegrityError is drv.IntegrityError)
149-
dbapi20._failUnless(self,con.InternalError is drv.InternalError)
150-
dbapi20._failUnless(self,con.ProgrammingError is drv.ProgrammingError)
151-
dbapi20. _failUnless(self,con.NotSupportedError is drv.NotSupportedError)
152-
finally:
153-
con.close()
154-
155-
156-
def test_rollback(self):
157-
# Workaround for https://github.com/baztian/dbapi-compliance/issues/5
158-
159-
con = self._connect()
160-
try:
161-
# If rollback is defined, it should either work or throw
162-
# the documented exception
163-
if hasattr(con,'rollback'):
164-
try:
165-
con.rollback()
166-
except self.driver.NotSupportedError:
167-
pass
168-
finally:
169-
con.close()

0 commit comments

Comments
 (0)