I am trying to bring a Django project from version 1.8 to 1.11. Pretty much everything seems to work fine except unit tests. We have a base test class inheriting from Django TestCase with a Tastypie mixin. The base class has some code in the setUp() like this
class BaseApiTest(ResourceTestCaseMixin, django.test.TestCase):
def setUp(self):
super().setUp()
self.username = "secret_user"
self.password = "sekret"
self.email = "[email protected]"
self.first_name = "FirstName"
self.last_name = "LastName"
self.user = User.objects.create_superuser(
self.username,
self.username,
self.password
)
And the app specific tests would inherit the base test and do something like
class TheAPITest(BaseApiTest):
def setUp(self):
super().setUp()
# more setup goes here
So, under Django 1.8.x this works fine. But under 1.11.x all of these give me an error on the User.objects.create_superuser() line
.
django.db.utils.InterfaceError: connection already closed
I have been going through the release notes, but there is just too much stuff that has happened between 1.8 and 1.11. Is there something simple that I am missing?