@@ -121,7 +121,9 @@ def test_structlog_context_middleware__any_request__returns_response_unchanged(m
121121 assert result is expected_response
122122
123123
124- def test_structlog_context_middleware__bindings_made_in_view__cleared_after_response (mocker ): # type: ignore[no-untyped-def]
124+ def test_structlog_context_middleware__bindings_made_in_view__cleared_after_response (
125+ mocker ,
126+ ): # type: ignore[no-untyped-def]
125127 # Given — a view that binds something onto contextvars
126128 def view_that_binds (_request ): # type: ignore[no-untyped-def]
127129 bind_contextvars (some_key = "some_value" )
@@ -136,7 +138,9 @@ def view_that_binds(_request): # type: ignore[no-untyped-def]
136138 assert get_contextvars () == {}
137139
138140
139- def test_structlog_context_middleware__view_exception__contextvars_still_cleared (mocker ): # type: ignore[no-untyped-def]
141+ def test_structlog_context_middleware__view_exception__contextvars_still_cleared (
142+ mocker ,
143+ ): # type: ignore[no-untyped-def]
140144 # Given — a view that binds then raises
141145 def faulty_view (_request ): # type: ignore[no-untyped-def]
142146 bind_contextvars (some_key = "some_value" )
@@ -151,7 +155,9 @@ def faulty_view(_request): # type: ignore[no-untyped-def]
151155 assert get_contextvars () == {}
152156
153157
154- def test_structlog_context_middleware__ffadmin_user__binds_user_id_and_organisation_id (mocker ): # type: ignore[no-untyped-def]
158+ def test_structlog_context_middleware__ffadmin_user__binds_user_id_and_organisation_id (
159+ mocker ,
160+ ): # type: ignore[no-untyped-def]
155161 # Given — an authenticated FFAdminUser with one organisation
156162 user = mocker .MagicMock (spec = FFAdminUser )
157163 user .is_authenticated = True
@@ -228,7 +234,9 @@ def view_captures_context(_request): # type: ignore[no-untyped-def]
228234 assert captured == {}
229235
230236
231- def test_structlog_context_middleware__ffadmin_user_with_no_organisations__binds_only_user_id (mocker ): # type: ignore[no-untyped-def]
237+ def test_structlog_context_middleware__ffadmin_user_with_no_organisations__binds_only_user_id (
238+ mocker ,
239+ ): # type: ignore[no-untyped-def]
232240 # Given — an FFAdminUser that belongs to no organisations
233241 user = mocker .MagicMock (spec = FFAdminUser )
234242 user .is_authenticated = True
@@ -253,7 +261,9 @@ def view_captures_context(_request): # type: ignore[no-untyped-def]
253261 assert captured == {"user__id" : "alice-uuid" }
254262
255263
256- def test_structlog_context_middleware__process_view_with_project_pk__binds_project_id (mocker ): # type: ignore[no-untyped-def]
264+ def test_structlog_context_middleware__process_view_with_project_pk__binds_project_id (
265+ mocker ,
266+ ): # type: ignore[no-untyped-def]
257267 # Given
258268 middleware = StructlogContextMiddleware (lambda _r : HttpResponse ())
259269
@@ -269,7 +279,9 @@ def test_structlog_context_middleware__process_view_with_project_pk__binds_proje
269279 assert get_contextvars () == {"project__id" : 42 }
270280
271281
272- def test_structlog_context_middleware__process_view_with_environment_api_key__binds_environment_id (mocker ): # type: ignore[no-untyped-def]
282+ def test_structlog_context_middleware__process_view_with_environment_api_key__binds_environment_id (
283+ mocker ,
284+ ): # type: ignore[no-untyped-def]
273285 # Given — Environment.get_from_cache returns a hit
274286 environment = mocker .MagicMock (id = 99 )
275287 mocker .patch (
@@ -290,7 +302,9 @@ def test_structlog_context_middleware__process_view_with_environment_api_key__bi
290302 assert get_contextvars () == {"environment__id" : 99 }
291303
292304
293- def test_structlog_context_middleware__process_view_with_unknown_environment_key__binds_nothing (mocker ): # type: ignore[no-untyped-def]
305+ def test_structlog_context_middleware__process_view_with_unknown_environment_key__binds_nothing (
306+ mocker ,
307+ ): # type: ignore[no-untyped-def]
294308 # Given — get_from_cache returns None (invalid/unknown key)
295309 mocker .patch (
296310 "core.middleware.structlog_context.Environment.get_from_cache" ,
@@ -310,7 +324,9 @@ def test_structlog_context_middleware__process_view_with_unknown_environment_key
310324 assert get_contextvars () == {}
311325
312326
313- def test_structlog_context_middleware__process_view_without_url_kwargs__binds_nothing (mocker ): # type: ignore[no-untyped-def]
327+ def test_structlog_context_middleware__process_view_without_url_kwargs__binds_nothing (
328+ mocker ,
329+ ): # type: ignore[no-untyped-def]
314330 # Given
315331 middleware = StructlogContextMiddleware (lambda _r : HttpResponse ())
316332
@@ -326,7 +342,9 @@ def test_structlog_context_middleware__process_view_without_url_kwargs__binds_no
326342 assert get_contextvars () == {}
327343
328344
329- def test_structlog_context_middleware__sequential_requests_on_same_instance__no_leakage (mocker ): # type: ignore[no-untyped-def]
345+ def test_structlog_context_middleware__sequential_requests_on_same_instance__no_leakage (
346+ mocker ,
347+ ): # type: ignore[no-untyped-def]
330348 """
331349 Cross-request leakage test (Flagsmith #7298 acceptance criterion).
332350
0 commit comments