On 09/04/2014 08:53 AM, galozek wrote:
> I'm trying to port my project to Django 1.7. Every goes fine except 1
> problem with an abstract model testing.
> Django 1.7 runs migrate command while testing. That means models not
> included in migrations are omitted. That's the issue I've got.
> 
> What I do in my /app/tests/ directory:
> 
>   * I keep there a dummy model: classTestBaseImage(BaseImage): pass
>   * All it does is to inherit from the abstract *BaseImage* model.
>   * In my tests, when I try to create an instance of TestBaseImage I get
>     DB error saying *table does not exist*
> 
> Is there any good way to make that work with new migration system? I
> don't want to include my dummy model in my migrations - that's obvious.
> I need a way to test that abstract model - it worked in Django 1.6 but
> with new migrations it doesn't.

Can you put the test model in its own models.py in a test-only "app",
and then include that test-only app in INSTALLED_APPS only when running
tests?

There is a long-time ticket requesting a cleaner way to do test-only
models: https://code.djangoproject.com/ticket/7835

The technique you were relying on wasn't documented and really only
worked by accident in previous Django versions.

Carl

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/54088E3E.3000902%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to