Skip to content

Multi db tests behave differently on different dbs #423

Closed
@obiwanus

Description

@obiwanus

I have two identical sqlite databases for testing

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'first',
    },
    'second': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'second',
    },
}

At the start of each test the default database is clean, but the second database contains the data from the previous test runs.
The transaction setting pytestmark = pytest.mark.django_db(transaction=True) doesn't seem to have any effect on the default database behaviour - it is always clean for every test regardless of whether transaction is True or False. The same is true for the second database except it's always dirty.

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