Skip to content

Commit 442a4d7

Browse files
committed
Use override_settings in a test where we can now do so
1 parent ccd9992 commit 442a4d7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

tests/test_pause_resume.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import io
22
import datetime
3-
import unittest
43
from unittest import mock
54

65
import fakeredis
76
import freezegun
87

8+
from django.test import SimpleTestCase, override_settings
99
from django.core.management import call_command, CommandError
1010

1111
from django_lightweight_queue.types import QueueName
@@ -18,7 +18,7 @@
1818
)
1919

2020

21-
class PauseResumeTests(unittest.TestCase):
21+
class PauseResumeTests(SimpleTestCase):
2222
longMessage = True
2323

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

5050
super().setUp()
5151

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

0 commit comments

Comments
 (0)