0

By running './manage.py test', data from local 'postgres' database are populated into 'test_postgres' database. I am not able to find way, how to disable this behavior. By running './manage.py test', I want to get non populated database with applied migrations.

class Local(Common):
    DEBUG = True

    # Testing
    INSTALLED_APPS = Common.INSTALLED_APPS
    INSTALLED_APPS += ('django_nose',)
    TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
    NOSE_ARGS = [
        BASE_DIR,
        '-s',
        '--nologcapture',
        '--with-coverage',
        '--with-progressive'
    ]
    # Postgres
    DATABASES = {
        'default': dj_database_url.config(
            default='postgres://postgres:@postgres:5432/postgres',
            conn_max_age=int(os.getenv('POSTGRES_CONN_MAX_AGE', 600)),
        )
    }
Korben
  • 13
  • 4

1 Answers1

1

By running './manage.py test', data from local 'postgres' database are populated into 'test_postgres' database.

No it isn't. Django will create a new empty database for each test.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895