Update of /cvsroot/pywin32/pywin32/adodbapi/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24504/tests
Modified Files:
adodbapitest.py adodbapitestconfig.py
Log Message:
adodbapi version 2.1.1
Bug fix so nextset() will work even if a result set is empty [Bob Kline]
Bug fix to call CoInintialize before calling Dispatch [Adam Vandenberg]
Cleanups to test routines
Index: adodbapitest.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/adodbapi/tests/adodbapitest.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** adodbapitest.py 4 Jan 2008 18:49:10 -0000 1.1.1.1
--- adodbapitest.py 6 Aug 2008 16:18:06 -0000 1.2
***************
*** 21,24 ****
--- 21,25 ----
Updated for decimal data and version 2.1 by Vernon Cole
+ AS400 tests removed v 2.1.1 - Vernon Cole
"""
***************
*** 388,394 ****
crsr.execute(tabdef)
! for multiplier in (1,decimal.Decimal('2.5'),78,9999,999999,7007):
crsr.execute("DELETE FROM tblTemp")
! crsr.execute("INSERT INTO tblTemp(fldCurr) VALUES (12.50*%f)" % multiplier)
sql="SELECT fldCurr FROM tblTemp "
--- 389,396 ----
crsr.execute(tabdef)
! for multiplier in (1,decimal.Decimal('2.5'),78,9999,99999,7007):
crsr.execute("DELETE FROM tblTemp")
! correct = decimal.Decimal('12.50') * multiplier
! crsr.execute("INSERT INTO tblTemp(fldCurr) VALUES (?)",[correct])
sql="SELECT fldCurr FROM tblTemp "
***************
*** 399,403 ****
print sql
fldcurr=crsr.fetchone()[0]
- correct = decimal.Decimal('12.50') * multiplier
self.assertEquals( fldcurr,correct)
--- 401,404 ----
***************
*** 535,538 ****
--- 536,550 ----
self.engine = 'ACCESS'
+ def tearDown(self):
+ try:
+ self.conn.rollback()
+ except:
+ pass
+ try:
+ self.conn.close()
+ except:
+ pass
+ self.conn=None
+
def getConnection(self):
return adodbapi.connect(adodbapitestconfig.connStrAccess)
***************
*** 561,584 ****
assert c != None
- class TestADOwithAS400DB(CommonDBTests):
- def setUp(self):
- try:
- adoConn=win32com.client.Dispatch("ADODB.Connection")
- except:
- self.fail('SetUpError: Is MDAC installed?')
- try:
- adoConn.Open(adodbapitestconfig.connStrAS400)
- except:
- self.fail('SetUpError: Can not connect to the testdatabase, all other tests will fail...\nAdo error:%s' % adoConn.Errors(0))
- self.engine = 'IBMDA400'
-
- def getConnection(self):
- return adodbapi.connect(adodbapitestconfig.connStrAS400)
-
- def testOkConnect(self):
- c=adodbapi.connect(adodbapitestconfig.connStrAS400)
- assert c != None
-
-
class TimeConverterInterfaceTest(unittest.TestCase):
def testIDate(self):
--- 573,576 ----
***************
*** 732,737 ****
if adodbapitestconfig.doMySqlTest:
suites.append( unittest.makeSuite(TestADOwithMySql,'test'))
! if adodbapitestconfig.doAS400Test:
! suites.append( unittest.makeSuite(TestADOwithAS400DB,'test'))
suite=unittest.TestSuite(suites)
if __name__ == '__main__':
--- 724,728 ----
if adodbapitestconfig.doMySqlTest:
suites.append( unittest.makeSuite(TestADOwithMySql,'test'))
!
suite=unittest.TestSuite(suites)
if __name__ == '__main__':
Index: adodbapitestconfig.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/adodbapi/tests/adodbapitestconfig.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** adodbapitestconfig.py 4 Jan 2008 18:49:10 -0000 1.1.1.1
--- adodbapitestconfig.py 6 Aug 2008 16:18:06 -0000 1.2
***************
*** 5,8 ****
--- 5,10 ----
doAccessTest = True
doSqlServerTest = True
+ doMySqlTest = True
+
try: #If mx extensions are installed, use mxDateTime
import mx.DateTime
***************
*** 10,15 ****
except:
doMxDateTimeTest=False #Requires eGenixMXExtensions
! doAS400Test = False
! doMySqlTest = False
import sys
if float(sys.version[:3])>2.29:
--- 12,17 ----
except:
doMxDateTimeTest=False #Requires eGenixMXExtensions
!
!
import sys
if float(sys.version[:3])>2.29:
***************
*** 82,89 ****
if doMySqlTest:
! _computername='5.128.134.143'
_databasename='test'
! connStrMySql = 'Driver={MySQL ODBC 3.51 Driver};Server=%s;Port=3306;Database=%s;Option=3;' % \
(_computername,_databasename)
print ' ...Testing MySql login...'
--- 84,91 ----
if doMySqlTest:
! _computername='10.100.5.249'
_databasename='test'
! connStrMySql = 'Driver={MySQL ODBC 5.1 Driver};Server=%s;Port=3306;Database=%s;Option=3;' % \
(_computername,_databasename)
print ' ...Testing MySql login...'
***************
*** 95,113 ****
doMySqlTest = False
! if doAS400Test:
! #OLE DB -> "PROVIDER=IBMDA400; DATA SOURCE=MY_SYSTEM_NAME;USER ID=myUserName;PASSWORD=myPwd;DEFAULT COLLECTION=MY_LIBRARY;"
! connStrAS400skl = "Provider=IBMDA400; DATA SOURCE=%s;DEFAULT COLLECTION=%s;User ID=%s;Password=%s"
! # NOTE! user's PC must have OLE support installed in IBM Client Access Express
! _computername='PEPPER'
! _databasename="DPDAN"
! _username = raw_input(' AS400 User ID for data retrieval [%s]:' % defaultUser)
! _password = getpass.getpass(' AS400 password:') #read the password
! connStrAS400 = connStrAS400skl % (_computername,_databasename,_username,_password) #build the connection string
! print ' ...Testing AS400 login...'
! try:
! s = adodbapi.connect(connStrAS400) #connect to server
! s.close()
! except adodbapi.DatabaseError, inst:
! print inst.args[0][2] # should be the AS400 error message
! doAS400Test = False
!
\ No newline at end of file
--- 97,99 ----
doMySqlTest = False
!
\ No newline at end of file
|