Skip to content

Commit

Permalink
Use override_settings in a test where we can now do so
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJCLaw committed Aug 6, 2022
1 parent ccd9992 commit 442a4d7
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tests/test_pause_resume.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import io
import datetime
import unittest
from unittest import mock

import fakeredis
import freezegun

from django.test import SimpleTestCase, override_settings
from django.core.management import call_command, CommandError

from django_lightweight_queue.types import QueueName
Expand All @@ -18,7 +18,7 @@
)


class PauseResumeTests(unittest.TestCase):
class PauseResumeTests(SimpleTestCase):
longMessage = True

def assertPaused(self, queue: QueueName, context: str) -> None:
Expand Down Expand Up @@ -49,11 +49,8 @@ def setUp(self) -> None:

super().setUp()

# Can't use override_settings due to the copying of the settings values into
# module values at startup.
@mock.patch(
'django_lightweight_queue.app_settings.Defaults.BACKEND',
new='django_lightweight_queue.backends.redis.RedisBackend',
@override_settings(
LIGHTWEIGHT_QUEUE_BACKEND='django_lightweight_queue.backends.redis.RedisBackend',
)
def test_pause_resume(self) -> None:
QUEUE = QueueName('test-pauseable-queue')
Expand Down

0 comments on commit 442a4d7

Please sign in to comment.