Hello, 

I have an issue trying to run tests.
My application use a migration to have default fixtures (created using 
migrations.RunPython from a migration file). 
The problem is when I launch manage.py test, the fixtures from the 
migration are created on the "production" database and not on the test_* 
database.

Is there a way to solve this issue ? Is this a known issue or nobody has 
this problem ?

Here is the migration

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


def create_bars(apps, schema_editor):
    Bar = apps.get_model("foo", "Bar")
    db_alias = schema_editor.connection.alias
    Bar.objects.using(db_alias).bulk_create([
        Bar(label="AAA"),
        Bar(label="BBB")
    ])

class Migration(migrations.Migration):

    dependencies = [
        ('foo', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(create_bars),
    ]


Thanks

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/748acda0-18dc-45e8-b79b-923b394d80dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to