You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,10 @@
38
38
- `explain_opts`: Parameters for explain. *(for more information about the parameters for explain, see the documentation for your DBMS).*
39
39
- `connection`: Connecting to your database, by default: django.db.connection
40
40
41
+
42
+
### > WARNING: If you use `pytest-xdist` and run the test with the `-n <workers>` flag, the results will not be reflected in the terminal. Remove the `-n <workers>` flag to display them.
'If you want to see the result of CaptureQueries, then remove the '
50
+
'-n <workers> parameter when starting pytest or use --capture=tee-sys -rP parameters.',
51
+
category=UserWarning,
52
+
stacklevel=2,
53
+
)
54
+
55
+
37
56
classCaptureQueries:
38
57
"""
39
58
#### Class to simplify the search for slow and suboptimal sql queries\
@@ -70,6 +89,10 @@ class CaptureQueries:
70
89
71
90
---
72
91
92
+
#### WARNING: If you use `pytest-xdist` and run the test with the `-n <workers>` flag, the results will not be reflected in the terminal. Remove the `-n <workers>` flag to display them.
93
+
94
+
---
95
+
73
96
#### Usage examples::
74
97
75
98
for ctx in CaptureQueries(number_runs=2, advanced_verb=True):
@@ -92,6 +115,7 @@ def test_request():
92
115
# OR
93
116
94
117
# NOTE: The with context manager does not support multi-launch number_runs > 1
118
+
# NOTE: Also you can use `async with` if you capture queries in async context.
95
119
with CaptureQueries(number_runs=1, advanced_verb=True) as ctx:
0 commit comments