Currently the tests are not Python 3 compatible. This following patch should fix those:
diff --git a/test/test_dbapi20.py b/test/test_dbapi20.py
index e37e595..e6b4edf 100644
--- a/test/test_dbapi20.py
+++ b/test/test_dbapi20.py
@@ -10,6 +10,8 @@
"""Driver specific portion of the DB API test suite provided by Stuart Bishop
available at http://stuartbishop.net/Software/DBAPI20TestSuite/"""
+from __future__ import print_function
+
import cx_Oracle
import dbapi20
import unittest
@@ -43,6 +45,6 @@ class TestSuite(dbapi20.DatabaseAPI20Test):
if __name__ == "__main__":
- print "Testing cx_Oracle version", cx_Oracle.version
+ print("Testing cx_Oracle version", cx_Oracle.version)
unittest.main()
diff --git a/test/uFeatures12_1.py b/test/uFeatures12_1.py
index ae45a1e..3d92e04 100644
--- a/test/uFeatures12_1.py
+++ b/test/uFeatures12_1.py
@@ -39,7 +39,7 @@ class TestArrayDMLBatchError(BaseTestCase):
self.cursor.executemany(sql, rows, arraydmlrowcounts = True)
self.connection.commit()
self.assertEqual(self.cursor.getarraydmlrowcounts(),
- [1L, 1L, 1L, 1L, 1L])
+ [1, 1, 1, 1, 1])
self.cursor.execute(u"select count(*) from TestArrayDML")
count, = self.cursor.fetchone()
self.assertEqual(count, len(rows))
@@ -54,7 +54,7 @@ class TestArrayDMLBatchError(BaseTestCase):
sql = u"insert into TestArrayDML (IntCol,StringCol) values (:1,:2)"
self.assertRaises(cx_Oracle.DatabaseError, self.cursor.executemany,
sql, rows, arraydmlrowcounts = True)
- self.assertEqual(self.cursor.getarraydmlrowcounts(), [1L, 1L])
+ self.assertEqual(self.cursor.getarraydmlrowcounts(), [1, 1])
def testExecutingDelete(self):
"test executing delete statement with arraydmlrowcount mode"
@@ -73,7 +73,7 @@ class TestArrayDMLBatchError(BaseTestCase):
rows = [ (200,), (300,), (400,) ]
statement = u"delete from TestArrayDML where IntCol2 = :1"
self.cursor.executemany(statement, rows, arraydmlrowcounts = True)
- self.assertEqual(self.cursor.getarraydmlrowcounts(), [1L, 3L, 2L])
+ self.assertEqual(self.cursor.getarraydmlrowcounts(), [1, 3, 2])
def testExecutingUpdate(self):
"test executing update statement with arraydmlrowcount mode"
@@ -96,7 +96,7 @@ class TestArrayDMLBatchError(BaseTestCase):
sql = u"update TestArrayDML set StringCol = :1 where IntCol2 = :2"
self.cursor.executemany(sql, rows, arraydmlrowcounts = True)
self.assertEqual(self.cursor.getarraydmlrowcounts(),
- [1L, 1L, 3L, 2L])
+ [1, 1, 3, 2])
def testInsertWithBatchError(self):
"test executing insert with multiple distinct batch errors"
@@ -120,7 +120,7 @@ class TestArrayDMLBatchError(BaseTestCase):
for e in self.cursor.getbatcherrors()]
self.assertEqual(actualErrors, expectedErrors)
self.assertEqual(self.cursor.getarraydmlrowcounts(),
- [1L, 1L, 0L, 1L, 0L])
+ [1, 1, 0, 1, 0])
def testBatchErrorFalse(self):
"test batcherrors mode set to False"
@@ -170,6 +170,6 @@ class TestArrayDMLBatchError(BaseTestCase):
for e in self.cursor.getbatcherrors()]
self.assertEqual(actualErrors, expectedErrors)
self.assertEqual(self.cursor.getarraydmlrowcounts(),
- [1L, 2L, 0L, 0L, 1L])
+ [1, 2, 0, 0, 1])
self.assertEqual(self.cursor.rowcount, 4)
diff --git a/test/uNumberVar.py b/test/uNumberVar.py
index 1487758..f13ea9b 100644
--- a/test/uNumberVar.py
+++ b/test/uNumberVar.py
@@ -23,7 +23,7 @@ class TestNumberVar(BaseTestCase):
floatCol = i + i * 0.75
unconstrainedCol = i ** 3 + i * 0.5
if i % 2:
- nullableCol = 143L ** i
+ nullableCol = 143 ** i
else:
nullableCol = None
dataTuple = (i, numberCol, floatCol, unconstrainedCol, nullableCol)
@@ -62,7 +62,7 @@ class TestNumberVar(BaseTestCase):
self.cursor.execute(u"""
select * from TestNumbers
where IntCol = :value""",
- value = 3L)
+ value = 3)
self.assertEqual(self.cursor.fetchall(), [self.dataByKey[3]])
def testBindLargeLong(self):