Skip to content

django_db_modify_db_settings fixture does nothing by default #814

Open
@sheats

Description

@sheats

I've implemented django_db_setup to do some fancy DB create/destroy logic and have been requesting django_db_modify_db_settings to give me a test db name at `settings.DATABASES['default']['TEST']['NAME']. When I upgraded from < 3.6 I now get this:

ipdb> pprint(settings.DATABASES['default']['TEST'])
{'CHARSET': None, 'COLLATION': None, 'MIRROR': None, 'NAME': None}

I don't use xdist or tox since it's just a small project. Here's what I'm doing:

@pytest.yield_fixture(scope="session")
def django_db_setup(
    django_db_modify_db_settings,
    django_db_blocker,
    django_db_keepdb,
    django_db_createdb,
):
    from django.conf import settings

    db = settings.DATABASES["default"]
    test_database_name = db["TEST"]["NAME"]

test_database_name used to come in with test_<default name> but now it's set to None.

Looks like #680 created a scenario where if you don't use xdist or tox the django_db_modify_db_settings fixture won't run _set_suffix_to_test_databases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions