Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teardown drops database if used in combination with live_server #1051

Open
jrief opened this issue Mar 14, 2023 · 0 comments
Open

Teardown drops database if used in combination with live_server #1051

jrief opened this issue Mar 14, 2023 · 0 comments

Comments

@jrief
Copy link

jrief commented Mar 14, 2023

In my project, I have an integration test which uses its own prefilled database. This means that in conftest.py, I overwrote this fixture as:

@pytest.fixture
def django_db_setup():
    pass

in order to prevent the database being created. This works fine until I introduced an end-to-end test using the fixture live_server. If this fixture is used, my database is dropped after all tests have finished. It of course is not very pleasant that a database is dropped by a 3rd party library which has been set up by someone else.

I haven't found any possibility to prevent dropping the database, since there is no fixture such as django_db_teardown which could be overridden.

I'm using Django-4.0.10, pytest-7.2.2, pytest-django-4.5.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant