Skip to content

Commit 12cf877

Browse files
committed
Avoid mutable global state in SettingsWrapper
1 parent baaafd8 commit 12cf877

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pytest_django/fixtures.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
TYPE_CHECKING,
99
Any,
1010
Callable,
11-
ClassVar,
1211
ContextManager,
1312
Generator,
1413
Iterable,
@@ -498,7 +497,9 @@ def async_rf() -> django.test.AsyncRequestFactory:
498497

499498

500499
class SettingsWrapper:
501-
_to_restore: ClassVar[list[Any]] = []
500+
def __init__(self) -> None:
501+
self._to_restore: list[django.test.override_settings]
502+
object.__setattr__(self, "_to_restore", [])
502503

503504
def __delattr__(self, attr: str) -> None:
504505
from django.test import override_settings

0 commit comments

Comments
 (0)