summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-01-12 21:46:08 +0100
committerClaude Paroz <claude@2xlibre.net>2013-01-12 21:46:08 +0100
commit0171ba65dbbff377282c03b86c83036168c84b22 (patch)
tree2e90a191856bc9aa02805eaf427474628b76afe7 /tests
parent223fc8eaf9d04eb2c277a30f4f46745d4403b69b (diff)
Fixed #17574 -- Implemented missing get_key_columns in PostgreSQL backend
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/introspection/tests.py36
1 files changed, 3 insertions, 33 deletions
diff --git a/tests/regressiontests/introspection/tests.py b/tests/regressiontests/introspection/tests.py
index 2df946d874..cd3e1cc8a4 100644
--- a/tests/regressiontests/introspection/tests.py
+++ b/tests/regressiontests/introspection/tests.py
@@ -1,10 +1,8 @@
from __future__ import absolute_import, unicode_literals
-from functools import update_wrapper
-
from django.db import connection
from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature
-from django.utils import six, unittest
+from django.utils import unittest
from .models import Reporter, Article
@@ -14,36 +12,7 @@ else:
expectedFailureOnOracle = lambda f: f
-# The introspection module is optional, so methods tested here might raise
-# NotImplementedError. This is perfectly acceptable behavior for the backend
-# in question, but the tests need to handle this without failing. Ideally we'd
-# skip these tests, but until #4788 is done we'll just ignore them.
-#
-# The easiest way to accomplish this is to decorate every test case with a
-# wrapper that ignores the exception.
-#
-# The metaclass is just for fun.
-
-
-def ignore_not_implemented(func):
- def _inner(*args, **kwargs):
- try:
- return func(*args, **kwargs)
- except NotImplementedError:
- return None
- update_wrapper(_inner, func)
- return _inner
-
-
-class IgnoreNotimplementedError(type):
- def __new__(cls, name, bases, attrs):
- for k, v in attrs.items():
- if k.startswith('test'):
- attrs[k] = ignore_not_implemented(v)
- return type.__new__(cls, name, bases, attrs)
-
-
-class IntrospectionTests(six.with_metaclass(IgnoreNotimplementedError, TestCase)):
+class IntrospectionTests(TestCase):
def test_table_names(self):
tl = connection.introspection.table_names()
self.assertEqual(tl, sorted(tl))
@@ -139,6 +108,7 @@ class IntrospectionTests(six.with_metaclass(IgnoreNotimplementedError, TestCase)
# That's {field_index: (field_index_other_table, other_table)}
self.assertEqual(relations, {3: (0, Reporter._meta.db_table)})
+ @skipUnlessDBFeature('can_introspect_foreign_keys')
def test_get_key_columns(self):
cursor = connection.cursor()
key_columns = connection.introspection.get_key_columns(cursor, Article._meta.db_table)