Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

test_helpers: Make use_db_models generic.

Zixuan James Li9d1ef72f0875
diff --git a/zerver/lib/test_helpers.py b/zerver/lib/test_helpers.py
index 69c181980f9..e6aafd3086a 100644
--- a/zerver/lib/test_helpers.py
+++ b/zerver/lib/test_helpers.py
@@ -570,10 +570,13 @@ def create_s3_buckets(*bucket_names: str) -> List[Bucket]:
return buckets
+TestCaseT = TypeVar("TestCaseT", bound="MigrationsTestCase")
+
+
def use_db_models(
- method: Callable[["MigrationsTestCase", StateApps], None]
-) -> Callable[["MigrationsTestCase", StateApps], None]: # nocoverage
- def method_patched_with_mock(self: "MigrationsTestCase", apps: StateApps) -> None:
+ method: Callable[[TestCaseT, StateApps], None]
+) -> Callable[[TestCaseT, StateApps], None]: # nocoverage
+ def method_patched_with_mock(self: TestCaseT, apps: StateApps) -> None:
ArchivedAttachment = apps.get_model("zerver", "ArchivedAttachment")
ArchivedMessage = apps.get_model("zerver", "ArchivedMessage")
ArchivedUserMessage = apps.get_model("zerver", "ArchivedUserMessage")