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

A fixture which gives access to all databases in tests #1113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dferens
Copy link

@dferens dferens commented Feb 13, 2024

Hi,

At my company we have a problem that we have to use mark on every test:

@pytest.mark.django_db(databases="__all__")
def test_something(db):
   ...

@pytest.mark.django_db(databases="__all__")
def test_other(db):
    ...

# + a bunch of tests which needs to be marked as well

I'd like to propose a solution:

def setup_db(db, django_db_all_databases):
    pass

def test_something(setup_db):
    ...

def test_other(setup_db):
    ...

Let me know what you think. If you approve this, I will improve this PR with tests, docs, docstrings and so on. I wanted to know your opinion first.

Thanks!

@dferens
Copy link
Author

dferens commented May 7, 2024

Hey, can anyone look into this?

@dferens dferens marked this pull request as ready for review May 7, 2024 14:25
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

Successfully merging this pull request may close these issues.

1 participant