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

Do not start the asynchronous task manager in tests #746

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

replaceafill
Copy link
Member

This avoids a runtime warning shown intermittently when tests are executed:

WARNING   2024-10-02 08:31:10  locations.models.async_manager:async_manager:_watchdog:61:  Failure in watchdog thread: Database access not allowed, use the "django_db" mark, or the "db" or "transactional_db" fixtures to enable it.
Traceback (most recent call last):
  File "/src/storage_service/locations/models/async_manager.py", line 59, in _watchdog
    AsyncManager._watchdog_loop()
  File "/src/storage_service/locations/models/async_manager.py", line 72, in _watchdog_loop
    Async.objects.filter(
  File "/pyenv/data/versions/3.9.20/lib/python3.9/site-packages/django/db/models/query.py", line 1148, in delete
    deleted, _rows_count = collector.delete()
  File "/pyenv/data/versions/3.9.20/lib/python3.9/site-packages/django/db/models/deletion.py", line 459, in delete
    with transaction.atomic(using=self.using, savepoint=False):
  File "/pyenv/data/versions/3.9.20/lib/python3.9/site-packages/django/db/transaction.py", line 198, in __enter__
    if not connection.get_autocommit():
  File "/pyenv/data/versions/3.9.20/lib/python3.9/site-packages/django/db/backends/base/base.py", line 464, in get_autocommit
    self.ensure_connection()
  File "/pyenv/data/versions/3.9.20/lib/python3.9/site-packages/pytest_django/plugin.py", line 813, in _blocking_wrapper
    raise RuntimeError(
RuntimeError: Database access not allowed, use the "django_db" mark, or the "db" or "transactional_db" fixtures to enable it.

Copy link
Contributor

@Dhwaniartefact Dhwaniartefact left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@replaceafill replaceafill merged commit cb9f0bc into qa/0.x Oct 3, 2024
8 of 9 checks passed
@replaceafill replaceafill deleted the dev/do-not-start-async-manager-in-tests branch October 3, 2024 16:54
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.

2 participants