Adding new models to test Django unit test case

35 views
Skip to first unread message

premdjango

unread,
Aug 15, 2016, 2:53:45 AM8/15/16
to Django users
I'm implementing a fix for a ticket-26819 and need to add new models to test it.

The new models were added to tests/postgres_tests/models.py
 but would like to know how to run the migrations before I run the tests.

Do I need to run the migrations explicitly or django run tests will take care of it?

Thanks,
Prem

Tim Graham

unread,
Aug 15, 2016, 11:18:33 AM8/15/16
to Django users
Migrations will run automatically but you need to add the models to the migrations in tests/postgres_tests/migrations.

premdjango

unread,
Aug 15, 2016, 5:00:42 PM8/15/16
to Django users
Thanks.
How do I run the migrations?

I tried python manage.py makemigrations but dont see the manage.py module anywhere.

Tim Graham

unread,
Aug 15, 2016, 5:12:52 PM8/15/16
to Django users
You'll need to modify the migrations manually. Take a look at a previous commit on the migrations files for an example.

premdjango

unread,
Aug 15, 2016, 5:48:48 PM8/15/16
to Django users
It worked..thanks.

premdjango

unread,
Aug 15, 2016, 6:50:32 PM8/15/16
to Django users
My pull requests failed - https://github.com/django/django/pull/7094

Looks like the test is running by default against sqllite. How do I run it against the postgres?

Tim Graham

unread,
Aug 15, 2016, 7:24:10 PM8/15/16
to Django users
We can continue the discussion on the pull request. Also, you can use the #django-dev IRC channel to get more immediate feedback.
Reply all
Reply to author
Forward
0 new messages