From ae3a22966d9524a3afe1f5c560f3e2a19e827729 Mon Sep 17 00:00:00 2001 From: 491034170 <142008960+491034170@users.noreply.github.com> Date: Wed, 10 Jun 2026 19:24:22 +0800 Subject: [PATCH 1/2] test(backend): isolate delete account purge stubs --- .../tests/unit/test_delete_account_purge_storage.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/tests/unit/test_delete_account_purge_storage.py b/backend/tests/unit/test_delete_account_purge_storage.py index 4cdefee2c11..e363325849c 100644 --- a/backend/tests/unit/test_delete_account_purge_storage.py +++ b/backend/tests/unit/test_delete_account_purge_storage.py @@ -48,6 +48,7 @@ def __getattr__(self, name): 'pusher', 'modal', 'ulid', + 'pytz', 'twilio', ) @@ -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() From 534ad233eef61f949a4579f9a64c9a216435123d Mon Sep 17 00:00:00 2001 From: 491034170 <142008960+491034170@users.noreply.github.com> Date: Wed, 10 Jun 2026 19:35:58 +0800 Subject: [PATCH 2/2] test(backend): isolate delete account stripe stubs --- .../tests/unit/test_delete_account_stripe_cancel.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/tests/unit/test_delete_account_stripe_cancel.py b/backend/tests/unit/test_delete_account_stripe_cancel.py index 4e648142b34..abbf96088da 100644 --- a/backend/tests/unit/test_delete_account_stripe_cancel.py +++ b/backend/tests/unit/test_delete_account_stripe_cancel.py @@ -47,6 +47,7 @@ def __getattr__(self, name): 'pusher', 'modal', 'ulid', + 'pytz', 'twilio', ) @@ -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()