Update of /cvsroot/pywin32/pywin32/adodbapi/tests
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29916/tests
Modified Files:
adodbapitest.py adodbapitestconfig.py db_print.py dbapi20.py
test_adodbapi_dbapi20.py
Added Files:
test.mdb
Log Message:
adodbapi v2.2.6 works with Python 3.0 (after 2to3)
Index: adodbapitest.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/adodbapi/tests/adodbapitest.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** adodbapitest.py 8 Dec 2008 18:13:53 -0000 1.7
--- adodbapitest.py 2 Feb 2009 03:48:41 -0000 1.8
***************
*** 1,3 ****
! """ Unit tests for adodbapi version 2.2.4"""
"""
adodbapi - A python DB API 2.0 interface to Microsoft ADO
--- 1,3 ----
! """ Unit tests for adodbapi version 2.2.6"""
"""
adodbapi - A python DB API 2.0 interface to Microsoft ADO
***************
*** 25,28 ****
--- 25,29 ----
import unittest
+ import sys
try:
***************
*** 274,280 ****
pass #self.helpTestDataType("BLOB",'BINARY',adodbapi.Binary('\x00\x01\xE2\x40'))
else:
! self.helpTestDataType("binary(4)",'BINARY',adodbapi.Binary('\x00\x01\xE2\x40'))
! self.helpTestDataType("varbinary(100)",'BINARY',adodbapi.Binary('\x00\x01\xE2\x40'))
! self.helpTestDataType("image",'BINARY',adodbapi.Binary('\x00\x01\xE2\x40'))
def helpRollbackTblTemp(self):
--- 275,283 ----
pass #self.helpTestDataType("BLOB",'BINARY',adodbapi.Binary('\x00\x01\xE2\x40'))
else:
! # python 3.0 syntax -> binfld = b'\x00\x01\xE2\x40'
! binfld = '\x00\x01\xE2\x40'
! self.helpTestDataType("binary(4)",'BINARY',adodbapi.Binary(binfld))
! self.helpTestDataType("varbinary(100)",'BINARY',adodbapi.Binary(binfld))
! self.helpTestDataType("image",'BINARY',adodbapi.Binary(binfld))
def helpRollbackTblTemp(self):
Index: adodbapitestconfig.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/adodbapi/tests/adodbapitestconfig.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** adodbapitestconfig.py 8 Dec 2008 18:13:53 -0000 1.6
--- adodbapitestconfig.py 2 Feb 2009 03:48:41 -0000 1.7
***************
*** 1,4 ****
# Configure this in order to run the testcases.
! "adodbapitestconfig.py v 2.2.4"
import os
--- 1,4 ----
# Configure this in order to run the testcases.
! "adodbapitestconfig.py v 2.2.5"
import os
***************
*** 80,89 ****
if doSqlServerTest:
! _computername="franklin" #or name of computer with SQL Server
_databasename="Northwind" #or something else
! _username="guest"
! _password="12345678"
! #connStrSQLServer = r"Provider=SQLOLEDB.1; Integrated Security=SSPI; Initial Catalog=%s;Data Source=%s" %(_databasename, _computername)
! connStrSQLServer = r"Provider=SQLOLEDB.1; User ID=%s; Password=%s; Initial Catalog=%s;Data Source=%s" %(_username,_password,_databasename, _computername)
print ' ...Testing MS-SQL login...'
try:
--- 80,89 ----
if doSqlServerTest:
! _computername=".\SQLEXPRESS" #or name of computer with SQL Server
_databasename="Northwind" #or something else
! #_username="guest"
! #_password="12345678"
! connStrSQLServer = r"Provider=SQLOLEDB.1; Integrated Security=SSPI; Initial Catalog=%s;Data Source=%s" %(_databasename, _computername)
! #connStrSQLServer = r"Provider=SQLOLEDB.1; User ID=%s; Password=%s; Initial Catalog=%s;Data Source=%s" %(_username,_password,_databasename, _computername)
print ' ...Testing MS-SQL login...'
try:
***************
*** 91,101 ****
s.close()
except adodbapi.DatabaseError, inst:
! print inst.args[0][2] # should be the error message
doSqlServerTest = False
if doMySqlTest:
! _computername='wciptest'
_databasename='test'
! _username = 'test'
_password = '12345678'
_driver="MySQL ODBC 5.1 Driver" # or _driver="MySQL ODBC 3.51 Driver"
--- 91,101 ----
s.close()
except adodbapi.DatabaseError, inst:
! print inst.args[0] # should be the error message
doSqlServerTest = False
if doMySqlTest:
! _computername='192.168.1.1'
_databasename='test'
! _username = 'Test'
_password = '12345678'
_driver="MySQL ODBC 5.1 Driver" # or _driver="MySQL ODBC 3.51 Driver"
***************
*** 107,110 ****
s.close()
except adodbapi.DatabaseError, inst:
! print inst.args[0][2] # should be the error message
doMySqlTest = False
--- 107,110 ----
s.close()
except adodbapi.DatabaseError, inst:
! print inst.args[0] # should be the error message
doMySqlTest = False
Index: dbapi20.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/adodbapi/tests/dbapi20.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** dbapi20.py 1 Oct 2008 14:44:53 -0000 1.2
--- dbapi20.py 2 Feb 2009 03:48:41 -0000 1.3
***************
*** 18,25 ****
import unittest
import time
# $Log$
! # Revision 1.2 2008/10/01 14:44:53 mhammond
! # Move to 'new style' exception raising.
#
# Revision 1.1.1.1 2008/01/04 18:49:10 kf7xm
--- 18,30 ----
import unittest
import time
+ import sys
# $Log$
! # Revision 1.3 2009/02/02 03:48:41 kf7xm
! # adodbapi v2.2.6 works with Python 3.0 (after 2to3)
! #
! # Revision 1.1.1.1.2.1 2008/09/20 19:54:59 rupole
! # Include latest changes from main branch
! # Updates for py3k
#
# Revision 1.1.1.1 2008/01/04 18:49:10 kf7xm
***************
*** 182,192 ****
# Make sure required exceptions exist, and are in the
# defined heirarchy.
! self.failUnless(issubclass(self.driver.Warning,StandardError))
! self.failUnless(issubclass(self.driver.Error,StandardError))
! self.failUnless(
! issubclass(self.driver.InterfaceError,self.driver.Error)
! )
self.failUnless(
! issubclass(self.driver.DatabaseError,self.driver.Error)
)
self.failUnless(
--- 187,200 ----
# Make sure required exceptions exist, and are in the
# defined heirarchy.
! if sys.version[0] == '3': #under Python 3 StardardError no longer exists
! self.failUnless(issubclass(self.driver.Warning,Exception))
! self.failUnless(issubclass(self.driver.Error,Exception))
! else:
! self.failUnless(issubclass(self.driver.Warning,StandardError))
! self.failUnless(issubclass(self.driver.Error,StandardError))
!
self.failUnless(
! issubclass(self.driver.InterfaceError,self.driver.Error))
! self.failUnless( issubclass(self.driver.DatabaseError,self.driver.Error)
)
self.failUnless(
***************
*** 709,713 ****
''' Should create a procedure called deleteme
that returns two result sets, first the
! number of rows in booze then "name from booze"
'''
raise NotImplementedError('Helper not implemented')
--- 717,721 ----
''' Should create a procedure called deleteme
that returns two result sets, first the
! number of rows in booze then "name from booze"
'''
raise NotImplementedError('Helper not implemented')
***************
*** 791,795 ****
def test_setoutputsize(self):
# Real test for setoutputsize is driver dependant
! raise NotImplementedError('Driver need to override this test')
def test_None(self):
--- 799,803 ----
def test_setoutputsize(self):
# Real test for setoutputsize is driver dependant
! raise NotImplementedError('Driver needed to override this test')
def test_None(self):
***************
*** 855,857 ****
'module.ROWID must be defined.'
)
-
--- 863,864 ----
Index: db_print.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/adodbapi/tests/db_print.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** db_print.py 11 Nov 2008 23:54:30 -0000 1.2
--- db_print.py 2 Feb 2009 03:48:41 -0000 1.3
***************
*** 4,35 ****
adodbapi.adodbapi.verbose = True # adds details to the sample printout
- _computername="franklin" #or name of computer with SQL Server
- _databasename="Northwind" #or something else
- _username="guest"
- _password='12345678'
-
- _table_name= 'Products'
-
# connection string templates from http://www.connectionstrings.com
!
! # Switch test providers by changing the "if False" below
# connection string for an Access data table:
! if False:
! _databasename = "C:/adodbapi-2.1/tests/Test.mdb"
# generic -> 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s; User Id=%s; Password=%s;' % (_databasename, _username, _password)
constr = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s' \
% _databasename
! _table_name= 'Test_tbl'
!
! if False:
! # this will open a MS-SQL table with Windows authentication
! constr = r"Initial Catalog=%s; Data Source=%s; Provider=SQLOLEDB.1; Integrated Security=SSPI" %(_databasename, _computername)
! # this set opens a MS-SQL table with SQL authentication
! if True:
! constr = r"Provider=SQLOLEDB.1; Initial Catalog=%s; Data Source=%s; user ID=%s; Password=%s; " \
% (_databasename, _computername, _username, _password)
!
# connection string for MySQL
if False:
--- 4,35 ----
adodbapi.adodbapi.verbose = True # adds details to the sample printout
# connection string templates from http://www.connectionstrings.com
! # Switch test providers by changing the "if True" below
# connection string for an Access data table:
! if True:
! _databasename = "Test.mdb"
# generic -> 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s; User Id=%s; Password=%s;' % (_databasename, _username, _password)
constr = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s' \
% _databasename
! _table_name= 'Products'
! #----------
! else:
! # connection string for an SQL server
! _computername="127.0.0.1" #or name of computer with SQL Server
! _databasename="Northwind" #or something else
! _table_name= 'Products'
! if True:
! # this will open a MS-SQL table with Windows authentication
! constr = r"Initial Catalog=%s; Data Source=%s; Provider=SQLOLEDB.1; Integrated Security=SSPI" \
! %(_databasename, _computername)
! else:
! _username="guest"
! _password='12345678'
! # this set opens a MS-SQL table with SQL authentication
! constr = r"Provider=SQLOLEDB.1; Initial Catalog=%s; Data Source=%s; user ID=%s; Password=%s; " \
% (_databasename, _computername, _username, _password)
! #-----------------------
# connection string for MySQL
if False:
***************
*** 40,56 ****
% (_computername,_databasename)
_table_name= 'Test_tbl'
!
# connection string for AS400
if False:
- _computername = "PEPPER"
- _databasename = 'CMSDTA00'
constr = "Provider=IBMDA400; DATA SOURCE=%s;DEFAULT COLLECTION=%s;User ID=%s;Password=%s" \
% (_computername, _databasename, _username, _password)
# NOTE! user's PC must have OLE support installed in IBM Client Access Express
! _table_name= 'CSPCM'
!
#tell the server we are not planning to update...
adodbapi.adodbapi.defaultIsolationLevel = adodbapi.adodbapi.adXactBrowse
! #and we want a local cursor
adodbapi.adodbapi.defaultCursorLocation = adodbapi.adodbapi.adUseClient
--- 40,55 ----
% (_computername,_databasename)
_table_name= 'Test_tbl'
! #-----------
# connection string for AS400
if False:
constr = "Provider=IBMDA400; DATA SOURCE=%s;DEFAULT COLLECTION=%s;User ID=%s;Password=%s" \
% (_computername, _databasename, _username, _password)
# NOTE! user's PC must have OLE support installed in IBM Client Access Express
! #-----------------
!
#tell the server we are not planning to update...
adodbapi.adodbapi.defaultIsolationLevel = adodbapi.adodbapi.adXactBrowse
!
! #and we want a local cursor (so that we will have an accurate rowcount)
adodbapi.adodbapi.defaultCursorLocation = adodbapi.adodbapi.adUseClient
--- NEW FILE: test.mdb ---
(This appears to be a binary file; contents omitted.)
Index: test_adodbapi_dbapi20.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/adodbapi/tests/test_adodbapi_dbapi20.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_adodbapi_dbapi20.py 8 Dec 2008 18:13:53 -0000 1.3
--- test_adodbapi_dbapi20.py 2 Feb 2009 03:48:41 -0000 1.4
***************
*** 3,17 ****
import dbapi20
- print "Tested with dbapi20 %s" % dbapi20.__version__
import unittest
! import adodbapitestconfig
import adodbapi
! import string
class test_adodbapi(dbapi20.DatabaseAPI20Test):
driver = adodbapi
! connect_args = (adodbapitestconfig.connStrSQLServer,)
connect_kw_args = {}
--- 3,36 ----
import dbapi20
import unittest
+ import os, sys, string
! #attempt to find adodbapi in this directory's parent
! cwd = os.getcwd()
! adoPath = os.path.normpath(cwd + '/../adodbapi.py')
! if os.path.exists(adoPath):
! if adoPath not in sys.path:
! sys.path.insert(1,os.path.dirname(adoPath))
import adodbapi
! print adodbapi.version
! print "Tested with dbapi20 %s" % dbapi20.__version__
!
! _computername=".\SQLEXPRESS" #or name of computer with SQL Server
! _databasename="Northwind" #or something else
! connStr = r"Provider=SQLOLEDB.1; Integrated Security=SSPI; Initial Catalog=%s;Data Source=%s" %(_databasename, _computername)
! #connStr = r"Provider=SQLOLEDB.1; User ID=%s; Password=%s; Initial Catalog=%s;Data Source=%s" %(_username,_password,_databasename, _computername)
!
! print ' ...Testing MS-SQL login...'
! try:
! s = adodbapi.connect(connStr) #connect to server
! s.close()
! except adodbapi.DatabaseError, inst:
! print inst.args[0] # should be the error message
! sys.exit(1)
class test_adodbapi(dbapi20.DatabaseAPI20Test):
driver = adodbapi
! connect_args = (connStr,)
connect_kw_args = {}
|