-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Models instantiated in Djangos setUpTestData seem to skip conditions #424
Comments
Hi @robinharms, how are you? I didn't get time to work on this. Do you still have this issue? Given the cost of setup to reproduce the issue, could you please provide me with a toy repository that I could quickly jump into and debug the error? |
Sure no problem, I can't do it right away but I'll try to get it done tomorrow! |
Here you go! Just ask if there's anything else I can do. Thanks a lot for this! |
Thanks, @robinharms! I was able to reproduce the issue locally. Here's what I've found: The root cause of the issue lies in the However, this conflicts with the creation strategy of state machines. The references of properties/methods used as actions/conditions are computed at the time of creation. So, when the state machine is cloned, the references still point to the original instance. I'm currently exploring potential solutions to this problem, if any. |
Nice! Thanks a lot for this! 😄 |
Description
The MachineMixin for Django seems to behave differently when models are used within django tests.
Oddly enough, any objects created during setUpTestData seem to cause transitions to bypass checks like
conditions.
What I Did
This is a simple django application. Create migrations, run tests.
(I'm skipping some imports for stuff you probably know)
statemachines.py
models.py
tests.py
The inner workings of the transitions are still a bit opaque to me, so sorry if there's something obvious I'm missing here.
Thanks for maintaining this great library!
The text was updated successfully, but these errors were encountered: