Skip to content

Commit

Permalink
Avoid mutable global state in SettingsWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
bluetech committed Nov 10, 2023
1 parent baaafd8 commit 12cf877
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pytest_django/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
TYPE_CHECKING,
Any,
Callable,
ClassVar,
ContextManager,
Generator,
Iterable,
Expand Down Expand Up @@ -498,7 +497,9 @@ def async_rf() -> django.test.AsyncRequestFactory:


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

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

0 comments on commit 12cf877

Please sign in to comment.