Skip to content

Commit f2ab54a

Browse files
committed
docs(django): remove PR references from test comments
Remove references to pending PRs and stacked branches from test comments to make the code ready to merge. Comments now only reference the implemented functionality and earlier versions (v6.7.11) for context.
1 parent b956cc9 commit f2ab54a

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

test_project_django5/test_exception_capture.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
"""
2-
Test that demonstrates the exception capture bug and fix.
2+
Test that verifies exception capture functionality.
33
4-
This test uses a real PostHog client with a test consumer to verify that
5-
exceptions are actually captured to PostHog, not just that 500 responses are returned.
4+
These tests verify that exceptions are actually captured to PostHog, not just that
5+
500 responses are returned.
66
7-
Bug: Without process_exception(), view exceptions are NOT captured to PostHog.
8-
Fix: PR #350 adds process_exception() which Django calls to capture exceptions.
7+
Without process_exception(), view exceptions are NOT captured to PostHog (v6.7.11 and earlier).
8+
With process_exception(), Django calls this method to capture exceptions before
9+
converting them to 500 responses.
910
"""
1011
import os
1112
import django
@@ -25,8 +26,8 @@ async def test_async_exception_is_captured():
2526
"""
2627
Test that async view exceptions are captured to PostHog.
2728
28-
With process_exception() (PR #350), exceptions are captured.
29-
Without it, exceptions are NOT captured even though 500 is returned.
29+
The middleware's process_exception() method ensures exceptions are captured.
30+
Without it (v6.7.11 and earlier), exceptions are NOT captured even though 500 is returned.
3031
"""
3132
from unittest.mock import patch
3233

@@ -67,8 +68,8 @@ async def test_sync_exception_is_captured():
6768
"""
6869
Test that sync view exceptions are captured to PostHog.
6970
70-
With process_exception() (PR #350), exceptions are captured.
71-
Without it, exceptions are NOT captured even though 500 is returned.
71+
The middleware's process_exception() method ensures exceptions are captured.
72+
Without it (v6.7.11 and earlier), exceptions are NOT captured even though 500 is returned.
7273
"""
7374
from unittest.mock import patch
7475

test_project_django5/test_middleware.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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
153151
async 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

169167
if __name__ == "__main__":

0 commit comments

Comments
 (0)