You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My migration is doing something like the following:
Note: Parent and Child are both subclasses of Activity, and there is a generic relation between them (not sure if this is related to the issues I'm seeing)
@pytest.mark.django_dbdeftest_activity_migration(migrator: Migrator):
old_state=migrator.apply_tested_migration(("app", an_old_migration_name))
Parent=old_state.apps.get_model("app", "Parent")
Child=old_state.apps.get_model("app", "Child")
# Data setupparent=Parent.objects.create(...)
Child.objects.create(..., parent=parent)
orig_parents_values=list(Parent.objects.values())
orig_children_values=list(Child.objects.values())
# Finish all migrations on appstate_0007=migrator.apply_tested_migration(("app", the_newer_migration_name))
state_0007_Parent=state_0007.apps.get_model("app", "Parent")
state_0007_Child=state_0007.apps.get_model("app", "Child")
state_0007_Activity=state_0007.apps.get_model("app", "Activity")
assertmodels.Activity.objects.count() ==2# do not make assertion for the parent_activity_idorig_children_values[0].pop("parent_id")
parent_0007=state_0007_Parent.objects.values().first()
child_0007=state_0007_Child.objects.values().first()
assert (
state_0007_Activity.objects.filter(id=parent["activity_ptr_id"])
.values(*orig_parents_values[0].keys())
.first()
==orig_parents_values[0]
)
assert (
state_0007_Activity.objects.filter(id=childActivity["activity_ptr_id"])
.values(*orig_children_values[0].keys())
.first()
==orig_children_values[0]
)
After squashing 2 unrelated migrations together (using manage.py squashmigrations, this test no longer runs. It gives me this traceback:
I am running django-test-migrations on squashed migrations in multiple projects and it works fine. I have tried to reproduce the exception you have listed, but without luck - could you please try to provide some minimal but runnable example of this issue?
My migration is doing something like the following:
Note: Parent and Child are both subclasses of Activity, and there is a generic relation between them (not sure if this is related to the issues I'm seeing)
After squashing 2 unrelated migrations together (using
manage.py squashmigrations
, this test no longer runs. It gives me this traceback:After this there is a second failure on the same test, related to the migrations not having applied successfully.
The text was updated successfully, but these errors were encountered: