diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 587cd874d98..7c00773d428 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -73,17 +73,6 @@ class BaseDatabaseWrapper(object): self.allow_thread_sharing = allow_thread_sharing self._thread_ident = thread.get_ident() - def __eq__(self, other): - if isinstance(other, BaseDatabaseWrapper): - return self.alias == other.alias - return NotImplemented - - def __ne__(self, other): - return not self == other - - def __hash__(self): - return hash(self.alias) - @property def queries(self): if len(self.queries_log) == self.queries_log.maxlen: diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt index 50d27aceb84..ade8f9b7dff 100644 --- a/docs/releases/1.8.txt +++ b/docs/releases/1.8.txt @@ -270,6 +270,9 @@ Miscellaneous * ``connections.queries`` is now a read-only attribute. +* Database connections are considered equal only if they're the same object. + They aren't hashable any more. + * ``URLField.to_python`` no longer adds a trailing slash to pathless URLs. * ``django.contrib.gis`` dropped support for GEOS 3.1 and GDAL 1.6. diff --git a/tests/db_backends/__init__.py b/tests/db_backends/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/db_backends/tests.py b/tests/db_backends/tests.py deleted file mode 100644 index 052ee872549..00000000000 --- a/tests/db_backends/tests.py +++ /dev/null @@ -1,36 +0,0 @@ -from django.test import TestCase -from django.db.backends import BaseDatabaseWrapper - - -class DummyDatabaseWrapper(BaseDatabaseWrapper): - pass - - -class DummyObject(object): - alias = None - - -class DbBackendTests(TestCase): - def test_compare_db_wrapper_with_another_object(self): - wrapper = BaseDatabaseWrapper({}) - self.assertFalse(wrapper == 'not-a-db-wrapper') - - def test_compare_db_wrapper_with_another_object_with_alias(self): - wrapper = BaseDatabaseWrapper({}) - obj = DummyObject() - obj.alias = wrapper.alias = 'foobar' - self.assertFalse(wrapper == obj) - - def test_negate_compare_db_wrapper_with_another_object(self): - wrapper = BaseDatabaseWrapper({}) - self.assertTrue(wrapper != 'not-a-db-wrapper') - - def test_compare_db_wrappers(self): - wrapper1 = DummyDatabaseWrapper({}) - wrapper2 = BaseDatabaseWrapper({}) - - wrapper1.alias = wrapper2.alias = 'foo' - self.assertTrue(wrapper1 == wrapper2) - - wrapper1.alias = 'bar' - self.assertFalse(wrapper1 == wrapper2)