wemake-services / django-test-migrations

Test django schema and data migrations, including migrations' order and best practices.

Home Page:https://pypi.org/project/django-test-migrations/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Migration signal muting occurs in the wrong place

GertBurger opened this issue · comments

The previous approach proposed in #11 uses a fixture to wrap the test which has the desired effect of muting signals before they are first emitted (pre_migrate) and un-muting them after the last emission (post_migrate).

The implementation in ab393b2 however performs the signal muting inside the transaction where it has no effect (Signals are muted after first emission and un-muted before last emission).

The following PoC/hack demonstrates a working approach master...GertBurger:move-signal-muting-to-fixture

I am not very familiar with pytest and its fixture ordering so the above approach may not be sufficient to ensure that the signal muting fixture always wraps the transaction fixture.

Thanks a lot, @GertBurger!
Looks good! Please, send a PR with the fix and I will merge it.

What about unittest case?