Я пытаюсь запустить некоторые тесты в моем приложении django, но у меня возникают ошибки при переносе.
Я использую docker-compose для запуска моего приложения. Я могу запустить сервер, добавить данные в базу данных разработчика без проблем, но когда я пытаюсь запустить тесты, у меня появляется эта ошибка:
python3 manage.py test -v 3
Creating test database for alias 'default' ('test_myapp')...
Operations to perform:
Synchronize unmigrated apps: gis, messages, rest_framework, staticfiles
Apply all migrations: admin, app, auth, authtoken, contenttypes, sessions, token_blacklist
Running pre-migrate handlers for application admin
Running pre-migrate handlers for application auth
Running pre-migrate handlers for application contenttypes
Running pre-migrate handlers for application sessions
Running pre-migrate handlers for application authtoken
Running pre-migrate handlers for application token_blacklist
Running pre-migrate handlers for application app
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
Running post-migrate handlers for application admin
Running post-migrate handlers for application auth
Running post-migrate handlers for application contenttypes
Running post-migrate handlers for application sessions
Running post-migrate handlers for application authtoken
Running post-migrate handlers for application token_blacklist
Running post-migrate handlers for application app
System check identified no issues (0 silenced).
Тесты запущены, но они используют devдБ (я могу получить доступ к своим данным dev в моих тестах), и я не могу запустить более одного тестового файла за раз без этой ошибки:
test_str (app.tests.tests_models.test_entity.TestEntity) ... Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor
return self._prepare_cursor(self.create_cursor(name))
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 223, in create_cursor
cursor = self.connection.cursor()
psycopg2.InterfaceError: connection already closed
Я уже пытался удалить свою базу данных, всепапки pycache и все миграции, повторные запуски makemigrations и migrate, но ошибка по-прежнему отображается ...