@@ -133,37 +133,35 @@ async def test_async_exception_capture():
133133 """
134134 Test that middleware handles exceptions from async views.
135135
136- This branch is stacked on PR #350 which adds process_exception() to capture
137- view exceptions. Django calls process_exception() for view exceptions, allowing
138- the middleware to capture them to PostHog before Django converts them to 500 responses.
139-
140- This test verifies the exception causes a 500 response. To verify actual PostHog
141- capture, you'd need to mock posthog.capture_exception (tested in PR #350).
136+ The middleware's process_exception() method captures view exceptions to PostHog
137+ before Django converts them to 500 responses. This test verifies the exception
138+ causes a 500 response. See test_exception_capture.py for tests that verify
139+ actual exception capture to PostHog.
142140 """
143141 app = get_asgi_application ()
144142 async with AsyncClient (transport = ASGITransport (app = app ), base_url = "http://testserver" ) as ac :
145143 response = await ac .get ("/test/async-exception" )
146144
147145 # Django returns 500 for unhandled exceptions
148146 assert response .status_code == 500
149- print ("✓ Async exception raises 500 (captured via process_exception from PR #350 )" )
147+ print ("✓ Async exception raises 500 (captured via process_exception)" )
150148
151149
152150@pytest .mark .asyncio
153151async def test_sync_exception_capture ():
154152 """
155153 Test that middleware handles exceptions from sync views.
156154
157- This branch is stacked on PR #350 which adds process_exception() to capture
158- view exceptions. This test verifies the exception causes a 500 response.
155+ The middleware's process_exception() method captures view exceptions to PostHog.
156+ This test verifies the exception causes a 500 response.
159157 """
160158 app = get_asgi_application ()
161159 async with AsyncClient (transport = ASGITransport (app = app ), base_url = "http://testserver" ) as ac :
162160 response = await ac .get ("/test/sync-exception" )
163161
164162 # Django returns 500 for unhandled exceptions
165163 assert response .status_code == 500
166- print ("✓ Sync exception raises 500 (captured via process_exception from PR #350 )" )
164+ print ("✓ Sync exception raises 500 (captured via process_exception)" )
167165
168166
169167if __name__ == "__main__" :
0 commit comments