summaryrefslogtreecommitdiff
path: root/test/testlib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-12-18 18:46:27 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-12-18 18:46:27 +0000
commit5ddce0ea00ff0534392ecabbb17b74becdcee4aa (patch)
treed147170332fe7ca79e93d5dc8a84cae33972d543 /test/testlib
parentd76dc73f33b6607b3805dc0efa29a98057afdb55 (diff)
downloadsqlalchemy-5ddce0ea00ff0534392ecabbb17b74becdcee4aa.tar.gz
*most* py3k warnings are resolved, with the exception of the various __setslice__ related warnings
I don't really know how to get rid of
Diffstat (limited to 'test/testlib')
-rw-r--r--test/testlib/assertsql.py7
-rw-r--r--test/testlib/sa_unittest.py23
2 files changed, 7 insertions, 23 deletions
diff --git a/test/testlib/assertsql.py b/test/testlib/assertsql.py
index 1cafd041a..dc2c6d40f 100644
--- a/test/testlib/assertsql.py
+++ b/test/testlib/assertsql.py
@@ -2,6 +2,7 @@
from sqlalchemy.interfaces import ConnectionProxy
from sqlalchemy.engine.default import DefaultDialect
from sqlalchemy.engine.base import Connection
+from sqlalchemy import util
import testing
import re
@@ -72,7 +73,7 @@ class ExactSQL(SQLMatchRule):
equivalent = _received_statement == sql
if self.params:
- if callable(self.params):
+ if util.callable(self.params):
params = self.params(context)
else:
params = self.params
@@ -106,7 +107,7 @@ class RegexSQL(SQLMatchRule):
equivalent = bool(self.regex.match(_received_statement))
if self.params:
- if callable(self.params):
+ if util.callable(self.params):
params = self.params(context)
else:
params = self.params
@@ -148,7 +149,7 @@ class CompiledSQL(SQLMatchRule):
equivalent = self.statement == _received_statement
if self.params:
- if callable(self.params):
+ if util.callable(self.params):
params = self.params(context)
else:
params = self.params
diff --git a/test/testlib/sa_unittest.py b/test/testlib/sa_unittest.py
index 912d7eb4d..8eb885829 100644
--- a/test/testlib/sa_unittest.py
+++ b/test/testlib/sa_unittest.py
@@ -36,6 +36,7 @@ __author__ = "Steve Purcell"
__email__ = "stephen_purcell at yahoo dot com"
__version__ = "#Revision: 1.63 $"[11:-2]
+from sqlalchemy.util import callable
import time
import sys
import traceback
@@ -53,22 +54,6 @@ __all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases'])
##############################################################################
-# Backward compatibility
-##############################################################################
-if sys.version_info[:2] < (2, 2):
- False, True = 0, 1
- def isinstance(obj, clsinfo):
- import __builtin__
- if type(clsinfo) in (tuple, list):
- for cls in clsinfo:
- if cls is type: cls = types.ClassType
- if __builtin__.isinstance(obj, cls):
- return 1
- return 0
- else: return __builtin__.isinstance(obj, clsinfo)
-
-
-##############################################################################
# Test framework core
##############################################################################
@@ -482,7 +467,6 @@ class TestLoader:
criteria and returning them wrapped in a Test
"""
testMethodPrefix = 'test'
- sortTestMethodsUsing = cmp
suiteClass = TestSuite
def loadTestsFromTestCase(self, testCaseClass):
@@ -556,6 +540,7 @@ class TestLoader:
def getTestCaseNames(self, testCaseClass):
"""Return a sorted sequence of method names found within testCaseClass
"""
+
def isTestMethod(attrname, testCaseClass=testCaseClass, prefix=self.testMethodPrefix):
return attrname.startswith(prefix) and callable(getattr(testCaseClass, attrname))
testFnNames = filter(isTestMethod, dir(testCaseClass))
@@ -563,8 +548,7 @@ class TestLoader:
for testFnName in self.getTestCaseNames(baseclass):
if testFnName not in testFnNames: # handle overridden methods
testFnNames.append(testFnName)
- if self.sortTestMethodsUsing:
- testFnNames.sort(self.sortTestMethodsUsing)
+ testFnNames.sort()
return testFnNames
@@ -578,7 +562,6 @@ defaultTestLoader = TestLoader()
def _makeLoader(prefix, sortUsing, suiteClass=None):
loader = TestLoader()
- loader.sortTestMethodsUsing = sortUsing
loader.testMethodPrefix = prefix
if suiteClass: loader.suiteClass = suiteClass
return loader