question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Django Q tasks are not executed with ./manage.py test

See original GitHub issue

Hello,

My models have some django Q task starting on certain action such as overridden Model.save() . The async tasks work correctly during functional testing, but the tasks are submitted but not executed if I hit the same code with ./manage.py test.

I just see some message of my 13:07:53 [Q] INFO Enqueued 1, probably of my tasks being queued, but they’re not executed.

Is this something expected?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
epinnacommented, Oct 12, 2017

That’s what I’ve done at the end 😃 thanks for your help.

1reaction
Eaglluscommented, Oct 12, 2017

@epinna a very easy solution would be to change a setting during you tests.

In your tests.py settings files

Q_CLUSTER = {
    'sync': True
}

or at the beginning of your test (if you only have a single test that needs it)

from django.conf import settings
settings.Q_CLUSTER['sync'] = True

This will remove the need to copy any code

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tasks — Django Q 1.3.6 documentation - Read the Docs
Simulates a task execution synchronously. Useful for testing. Can also be forced globally via the sync configuration option. cached¶. Redirects the result to ......
Read more >
Mock async_task of Django-q - unit testing - Stack Overflow
I'm using django-q and I'm currently working on adding tests using mock for my existing tasks. I could easily create tests for each...
Read more >
Koed00/django-q - Gitter
I have found that my dev VM can't handle the load. All the focus seems to be on adding items to the queue...
Read more >
django-toosimple-q - PyPI
A simplistic task queue and cron-like scheduler for Django. ... long # running tasks don't prevent short running tasks # from being run...
Read more >
Job Queues and Workers in Django - Honeybadger.io
Now, when you run you project with python manage.py runserver and open ... Django Q is an application used to manage job/task queues...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found