|
@@ -1,4 +1,4 @@
|
|
-from __future__ import absolute_import,unicode_literals
|
|
|
|
|
|
+from __future__ import absolute_import, unicode_literals
|
|
|
|
|
|
from functools import update_wrapper
|
|
from functools import update_wrapper
|
|
|
|
|
|
@@ -13,7 +13,7 @@ if connection.vendor == 'oracle':
|
|
else:
|
|
else:
|
|
expectedFailureOnOracle = lambda f: f
|
|
expectedFailureOnOracle = lambda f: f
|
|
|
|
|
|
-#
|
|
|
|
|
|
+
|
|
# The introspection module is optional, so methods tested here might raise
|
|
# The introspection module is optional, so methods tested here might raise
|
|
# NotImplementedError. This is perfectly acceptable behavior for the backend
|
|
# NotImplementedError. This is perfectly acceptable behavior for the backend
|
|
# in question, but the tests need to handle this without failing. Ideally we'd
|
|
# in question, but the tests need to handle this without failing. Ideally we'd
|
|
@@ -23,7 +23,7 @@ else:
|
|
# wrapper that ignores the exception.
|
|
# wrapper that ignores the exception.
|
|
#
|
|
#
|
|
# The metaclass is just for fun.
|
|
# The metaclass is just for fun.
|
|
-#
|
|
|
|
|
|
+
|
|
|
|
|
|
def ignore_not_implemented(func):
|
|
def ignore_not_implemented(func):
|
|
def _inner(*args, **kwargs):
|
|
def _inner(*args, **kwargs):
|
|
@@ -34,15 +34,16 @@ def ignore_not_implemented(func):
|
|
update_wrapper(_inner, func)
|
|
update_wrapper(_inner, func)
|
|
return _inner
|
|
return _inner
|
|
|
|
|
|
|
|
+
|
|
class IgnoreNotimplementedError(type):
|
|
class IgnoreNotimplementedError(type):
|
|
def __new__(cls, name, bases, attrs):
|
|
def __new__(cls, name, bases, attrs):
|
|
- for k,v in attrs.items():
|
|
|
|
|
|
+ for k, v in attrs.items():
|
|
if k.startswith('test'):
|
|
if k.startswith('test'):
|
|
attrs[k] = ignore_not_implemented(v)
|
|
attrs[k] = ignore_not_implemented(v)
|
|
return type.__new__(cls, name, bases, attrs)
|
|
return type.__new__(cls, name, bases, attrs)
|
|
|
|
|
|
-class IntrospectionTests(six.with_metaclass(IgnoreNotimplementedError, TestCase)):
|
|
|
|
|
|
|
|
|
|
+class IntrospectionTests(six.with_metaclass(IgnoreNotimplementedError, TestCase)):
|
|
def test_table_names(self):
|
|
def test_table_names(self):
|
|
tl = connection.introspection.table_names()
|
|
tl = connection.introspection.table_names()
|
|
self.assertEqual(tl, sorted(tl))
|
|
self.assertEqual(tl, sorted(tl))
|
|
@@ -163,6 +164,7 @@ class IntrospectionTests(six.with_metaclass(IgnoreNotimplementedError, TestCase)
|
|
self.assertNotIn('first_name', indexes)
|
|
self.assertNotIn('first_name', indexes)
|
|
self.assertIn('id', indexes)
|
|
self.assertIn('id', indexes)
|
|
|
|
|
|
|
|
+
|
|
def datatype(dbtype, description):
|
|
def datatype(dbtype, description):
|
|
"""Helper to convert a data type into a string."""
|
|
"""Helper to convert a data type into a string."""
|
|
dt = connection.introspection.get_field_type(dbtype, description)
|
|
dt = connection.introspection.get_field_type(dbtype, description)
|