8000 Django q with pytest · Issue #716 · Koed00/django-q · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content 10000
Django q with pytest #716
Open
Open
@ashleych

Description

@ashleych

Many thanks for a great package. Works excellent for my use case.
I was beginning to write some tests that involve async tasks, and I realised these tests (pytests) were failing because the async job isnt looking at the right database. How does one point django-q /qcluster to look at the test database that pytest uses.
im mostly using the default settings from Django.
DATABASE related settings.py looks like this
'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', 'TEST': { 'NAME': BASE_DIR / 'testdb.sqlite3', }, },
I am running this to check what is the db being connected to.
from django.db import connection db_name = connection.settings_dict['NAME']
When the function is being run in non async mode - it rightly points to the testdb.sqlite3.
When run using async mode, it points to the db.sqlite3.
How do i make the async task to refer to the testdb.
Any pointers would be very helpful.

PS: If I call the async function with sync=True, then everything works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0