django-easy-audit
django-easy-audit copied to clipboard
Exception When running tests
I have a Django (v 3.2.12 - Python 3.8) app and django-easy-audit version 1.3.2. Although in general everything is working fine, when I am running the test suit (django.test) I get the following exception:
psycopg2.errors.UndefinedTable: relation "easyaudit_crudevent" does not exist
In my understanding, the table is not created at the point of the execution of the test. I have added the following dependency to my initial migration:
dependencies = [ ("easyaudit", "__latest__") ]
But the error persists.
Is there anything else I can try?
i have the same issue
Could you please post the output of running
./manage.py migrate
on an empty database?
Having the same error when running tests. Will investigate and publish logs here.
Looks like the issue was being caused by one of my data migrations that was pre-populating the database. I just had to add the following to the migration dependencies list:
dependencies = [
...,
("easyaudit", "__latest__"),
]
Can you post some logs?
And what’s the order of INSTALLED_APPS
and MIDDLEWARE
?
Ended up running into the same issue. It happens when running migrate
and a data migration is applied and therefore also when running tests (since migrations are run on the test database as well).
I wonder if there is a way to disable the model signals during migrations. I would prefer not to have to make the migrations depend on easyaudit
.