I'm not sure what the specific issue with migrations is but this article has a nice trick (intended for making temporary models/tables) that would allow you to bring in a model and get it to sync whenever you like. I'd suggest putting this in your test setUp() method. It uses 'syncdb' cause it's pre-1.7 but you could try it with 'migrate' and see if that works as well. I haven't tried this for a long time so please post your results/workarounds if you manage to incorporate it in your solution.
blog.roseman.org.uk/2010/04/13/temporary-models-django/ -- Ben On Thu, Sep 4, 2014 at 10:03 PM, galgal <weglarek.rob...@gmail.com> wrote: > Hi, > I'm trying to port my project to use Django 1.7. Everything is fine except > 1 thing. Models inside tests folders. > Django 1.7 new migrations run *migrate* command internally. Before *syncdb > *was ran. That means if a model is not included in migrations - it won't > be populated to DB (and also to test DB). That's exactly what I'm > experiencing right now. > > What I do is: > > - In my /app/tests/models.py I have dummy model: class TestBaseImage( > BaseImage): pass > - All it does is to inherit from an *abstract **BaseImage* model. > - Then in tests I create instances of that dummy model to test it. > > The problem is that it doesn't work any more. It's not included in > migrations (that's obvious as I don't want to keep my test code in > production DB). Running my tests causes DB error saying that *table does > not exist*. That makes sense as it's not included in migrations. > > Is there any way to make it work with new migrations system? I can't find > a way to "fix" that. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/2236bfb7-7676-4caf-a6b1-9438ec5bba93%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/2236bfb7-7676-4caf-a6b1-9438ec5bba93%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Chief Systems Architect Proteus Technologies <http://proteus-tech.com> Chief Fan Biggest Fan Productions <http://biggestfan.net> Personal blog where I am not your demographic <http://notyourdemographic.com>. This email intended solely for those who have received it. If you have received this email by accident - well lucky you!! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHN%3D9D6%3DGJA96cK1P-K5UkiTh04MkpQky-acAVuJt_OhGnSPxw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.