Skip to main content

Disable migrations when running your Django tests.

Project description

Django Test Without Migrations: Disable migrations when running your Django tests

Test Status Code Helth Latest PyPI version Number of PyPI downloads License

Test Without Migrations is a manage.py test command extension.

The new Django 1.7 and 1.8 migration backend demands that you create a migration every time you change a model.

This can be inconvenient when you’re just trying to explore your models code.

In older Django versions, with South we could use the SOUTH_TEST_MIGRATIONS settings to tell Django to simply create all model tables without running migrations.

This app adds this capability to Django by extending the manage.py test command with a –nomigrations option.

Installation

Test Without Migrations works with Django 1.7+.

To install it, simply:

$ pip install django-test-without-migrations

Then add it to your INSTALLED_APPS on your settings.py:

INSTALLED_APPS = (
    # ...
    'test_without_migrations',
)

You will want to make sure that test_without_migrations appears before any other apps in INSTALLED_APPS that provide a custom test management command.

In this case, you will also want to set the TEST_WITHOUT_MIGRATIONS_COMMAND setting:

TEST_WITHOUT_MIGRATIONS_COMMAND = 'django_nose.management.commands.test.Command'

This will ensure that you don’t lose any additional functionality provided by your custom test management command.

Usage

Inform the flag --nomigrations when running your tests:

$ python manage.py test --nomigrations

Or use the alias -n:

$ python manage.py test -n

Inspiration

This library was directly inspired by this solution: https://gist.github.com/NotSqrt/5f3c76cd15e40ef62d09

Author

License

The MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-test-without-migrations-0.4.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_test_without_migrations-0.4-py2.py3-none-any.whl (6.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-test-without-migrations-0.4.tar.gz.

File metadata

File hashes

Hashes for django-test-without-migrations-0.4.tar.gz
Algorithm Hash digest
SHA256 2b69474796827083bd3f3cb242c87a57e6fecf3f5bb7c87dfab46e589464a07c
MD5 77e2ea22404b3daa07394ed50a833b3d
BLAKE2b-256 99381b8e963a3c9800d5bc0d55ebd3d6ad7d25394a90c55e3e9f8c6cd4123617

See more details on using hashes here.

File details

Details for the file django_test_without_migrations-0.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_test_without_migrations-0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6406aa7bb954508577c591f10bdc17424d98493278677818d84149bdadb5f42d
MD5 d078a70f6c63cb6abb7dda7dce584315
BLAKE2b-256 ef98c9d1d6fd5dcb5d82d601db70a8b97d1b197bb048b7fbc3dc675f10b6b873

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page