summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-06-11 19:45:35 +0100
committerDavid Robertson <davidr@element.io>2022-06-11 19:45:35 +0100
commit395d624e120643d51fd4693346bafce40fe6a48a (patch)
tree00816f39c402b59737df0153dbc064b733a83c1f
parentIntroduce a Looper type (diff)
downloadsynapse-395d624e120643d51fd4693346bafce40fe6a48a.tar.xz
Suppress checking of a mock
-rw-r--r--tests/utils.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/utils.py b/tests/utils.py
index d3da559200..abdc0eaadd 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -221,10 +221,15 @@ def default_config(
     return config_dict
 
 
-def mock_getRawHeaders(headers=None):
+def mock_getRawHeaders(headers=None):  # type: ignore[no-untyped-def]
     headers = headers if headers is not None else {}
 
-    def getRawHeaders(name, default=None):
+    def getRawHeaders(name, default=None):  # type: ignore[no-untyped-def]
+        # If the requested header is present, the real twisted function returns
+        # List[str] if name is a str and List[bytes] if name is a bytes.
+        # This mock doesn't support that behaviour.
+        # Fortunately, none of the current callers of mock_getRawHeaders() provide a
+        # headers dict, so we don't encounter this discrepancy in practice.
         return headers.get(name, default)
 
     return getRawHeaders