1
+ from __future__ import absolute_import
2
+
1
3
import pytest
2
4
import json
3
5
@@ -81,6 +83,7 @@ def test_transaction_with_class_view(sentry_init, client, capture_events):
81
83
assert event ["message" ] == "hi"
82
84
83
85
86
+ @pytest .mark .forked
84
87
@pytest .mark .django_db
85
88
def test_user_captured (sentry_init , client , capture_events ):
86
89
sentry_init (integrations = [DjangoIntegration ()], send_default_pii = True )
@@ -102,6 +105,7 @@ def test_user_captured(sentry_init, client, capture_events):
102
105
}
103
106
104
107
108
+ @pytest .mark .forked
105
109
@pytest .mark .django_db
106
110
def test_queryset_repr (sentry_init , capture_events ):
107
111
sentry_init (integrations = [DjangoIntegration ()])
@@ -156,6 +160,7 @@ def test_500(sentry_init, client, capture_events):
156
160
assert content == "Sentry error: %s" % event_id
157
161
158
162
163
+ @pytest .mark .forked
159
164
def test_management_command_raises ():
160
165
# This just checks for our assumption that Django passes through all
161
166
# exceptions by default, so our excepthook can be used for management
@@ -164,6 +169,7 @@ def test_management_command_raises():
164
169
execute_from_command_line (["manage.py" , "mycrash" ])
165
170
166
171
172
+ @pytest .mark .forked
167
173
@pytest .mark .django_db
168
174
@pytest .mark .parametrize ("with_integration" , [True , False ])
169
175
def test_sql_queries (sentry_init , capture_events , with_integration ):
@@ -175,9 +181,16 @@ def test_sql_queries(sentry_init, capture_events, with_integration):
175
181
176
182
from django .db import connection
177
183
178
- sql = connection .cursor ()
184
+ sentry_init (
185
+ integrations = [DjangoIntegration ()],
186
+ send_default_pii = True ,
187
+ _experiments = {"record_sql_params" : True },
188
+ )
179
189
180
190
events = capture_events ()
191
+
192
+ sql = connection .cursor ()
193
+
181
194
with pytest .raises (OperationalError ):
182
195
# table doesn't even exist
183
196
sql .execute ("""SELECT count(*) FROM people_person WHERE foo = %s""" , [123 ])
@@ -193,6 +206,7 @@ def test_sql_queries(sentry_init, capture_events, with_integration):
193
206
assert crumb ["data" ]["db.params" ] == [123 ]
194
207
195
208
209
+ @pytest .mark .forked
196
210
@pytest .mark .django_db
197
211
def test_sql_dict_query_params (sentry_init , capture_events ):
198
212
sentry_init (
@@ -234,6 +248,7 @@ def test_sql_dict_query_params(sentry_init, capture_events):
234
248
lambda sql : sql .SQL ('SELECT %(my_param)s FROM "foobar"' ),
235
249
],
236
250
)
251
+ @pytest .mark .forked
237
252
@pytest .mark .django_db
238
253
def test_sql_psycopg2_string_composition (sentry_init , capture_events , query ):
239
254
sentry_init (
@@ -262,6 +277,7 @@ def test_sql_psycopg2_string_composition(sentry_init, capture_events, query):
262
277
assert crumb ["data" ]["db.params" ] == {"my_param" : 10 }
263
278
264
279
280
+ @pytest .mark .forked
265
281
@pytest .mark .django_db
266
282
def test_sql_psycopg2_placeholders (sentry_init , capture_events ):
267
283
sentry_init (
0 commit comments