Have you been able to fix the problem? I am encountering the same issue on both Django 1.8.4 and 1.8.5.
Any help would be appreciated. On Thursday, October 8, 2015 at 3:38:16 PM UTC+1, thinkwell wrote: > > I could use some assistance in troubleshooting a psycopg2.InterfaceError > problem that has erratic behavior. Here is the test module > <http://pastebin.com/QrD6aQGK> suite that I'm running to test these models > <http://pastebin.com/FWCWg9Q5>, and in this state all the tests in the > module pass. However, it's extremely easy to trigger a > psycopg2.InterfaceError, although not relating to the lines changed. For > example, if I change: > > class TestSilly(SimpleTestCase): > > def test_is_not_false(self): > self.assertTrue(False is not True) > > > to > > class TestSilly(TestCase): > > def test_is_not_false(self): > self.assertTrue(False is not True) > > > > Then this error is raised, but referencing TestPolicyModel instead of > TestSilly! > > ====================================================================== > ERROR: test_toggle_autofix (accounts.tests.test_models.TestPolicyModel) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File > "/usr/local/lib/python3.4/dist-packages/django/db/backends/base/base.py", > line 137, in _cursor > return self.create_cursor() > File > "/usr/local/lib/python3.4/dist-packages/django/db/backends/postgresql_psycopg2/base.py" > , line 212, in create_cursor > cursor = self.connection.cursor() > psycopg2.InterfaceError: connection already closed > > The above exception was the direct cause of the following exception: > > Traceback (most recent call last): > File "apps/accounts/tests/test_models.py", line 174, in > test_toggle_autofix > p = Policy.objects.first() > File > "/usr/local/lib/python3.4/dist-packages/django/db/models/manager.py", > line 127, in manager_method > return getattr(self.get_queryset(), name)(*args, **kwargs) > File "/usr/local/lib/python3.4/dist-packages/django/db/models/query.py", > line 490, in first > objects = list((self if self.ordered else self.order_by('pk'))[:1]) > File "/usr/local/lib/python3.4/dist-packages/django/db/models/query.py", > line 162, in __iter__ > self._fetch_all() > File "/usr/local/lib/python3.4/dist-packages/django/db/models/query.py", > line 965, in _fetch_all > self._result_cache = list(self.iterator()) > File "/usr/local/lib/python3.4/dist-packages/django/db/models/query.py", > line 238, in iterator > results = compiler.execute_sql() > File > "/usr/local/lib/python3.4/dist-packages/django/db/models/sql/compiler.py", > line 838, in execute_sql > cursor = self.connection.cursor() > File > "/usr/local/lib/python3.4/dist-packages/django/db/backends/base/base.py", > line 164, in cursor > cursor = self.make_cursor(self._cursor()) > File > "/usr/local/lib/python3.4/dist-packages/django/db/backends/base/base.py", > line 137, in _cursor > return self.create_cursor() > File "/usr/local/lib/python3.4/dist-packages/django/db/utils.py", line > 97, in __exit__ > six.reraise(dj_exc_type, dj_exc_value, traceback) > File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line > 658, in reraise > raise value.with_traceback(tb) > File > "/usr/local/lib/python3.4/dist-packages/django/db/backends/base/base.py", > line 137, in _cursor > return self.create_cursor() > File > "/usr/local/lib/python3.4/dist-packages/django/db/backends/postgresql_psycopg2/base.py" > , line 212, in create_cursor > cursor = self.connection.cursor() > django.db.utils.InterfaceError: connection already closed > > > For another example, if I change > > TestPolicyModel(TestCase) > > > to > > TestPolicyModel(SimpleTestCase) > > > then, I get the following error regarding TestRedwoodModel > > ====================================================================== > ERROR: setUpClass (accounts.tests.test_models.TestRedwoodModel) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File > "/usr/local/lib/python3.4/dist-packages/django/db/backends/base/base.py", > line 137, in _cursor > return self.create_cursor() > File > "/usr/local/lib/python3.4/dist-packages/django/db/backends/postgresql_psycopg2/base.py" > , line 212, in create_cursor > cursor = self.connection.cursor() > psycopg2.InterfaceError: connection already closed > > The above exception was the direct cause of the following exception: > > Traceback (most recent call last): > File "apps/accounts/tests/test_models.py", line 195, in setUpClass > cls.ru = RedwoodUsers.objects.first() > File > "/usr/local/lib/python3.4/dist-packages/django/db/models/manager.py", > line 127, in manager_method > return getattr(self.get_queryset(), name)(*args, **kwargs) > File "/usr/local/lib/python3.4/dist-packages/django/db/models/query.py", > line 490, in first > objects = list((self if self.ordered else self.order_by( > ... -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/716aa277-232d-40e0-ab6f-e2015158ab32%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

