Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions backend/tests/unit/test_delete_account_purge_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __getattr__(self, name):
'pusher',
'modal',
'ulid',
'pytz',
'twilio',
)

Expand All @@ -58,6 +59,16 @@ def _should_stub(name: str) -> bool:
return any(name == p or name.startswith(p + '.') for p in _STUB_PREFIXES)


def _remove_module_tree(prefix: str) -> None:
for name in list(sys.modules):
if name == prefix or name.startswith(prefix + '.'):
sys.modules.pop(name, None)


for _prefix in _STUB_PREFIXES:
_remove_module_tree(_prefix)


class _StubFinder(importlib.abc.MetaPathFinder, importlib.abc.Loader):
def __init__(self):
self.created = set()
Expand Down
11 changes: 11 additions & 0 deletions backend/tests/unit/test_delete_account_stripe_cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __getattr__(self, name):
'pusher',
'modal',
'ulid',
'pytz',
'twilio',
)

Expand All @@ -57,6 +58,16 @@ def _should_stub(name: str) -> bool:
return any(name == p or name.startswith(p + '.') for p in _STUB_PREFIXES)


def _remove_module_tree(prefix: str) -> None:
for name in list(sys.modules):
if name == prefix or name.startswith(prefix + '.'):
sys.modules.pop(name, None)


for _prefix in _STUB_PREFIXES:
_remove_module_tree(_prefix)


class _StubFinder(importlib.abc.MetaPathFinder, importlib.abc.Loader):
def __init__(self):
self.created = set()
Expand Down
Loading