File tree 2 files changed +10
-4
lines changed 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ Additional command line options
29
29
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30
30
Fail tests that render templates which make use of invalid template variables.
31
31
32
+
33
+ ``--querycount `` - show top N tests with most queries
34
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35
+ Show a list of top N tests which executed most queries. Use `--querycount=0 `
36
+ to display a list of all tests ordered by the number of queries executed.
37
+
32
38
Running tests in parallel with pytest-xdist
33
39
-------------------------------------------
34
40
pytest-django supports running tests on multiple processes to speed up test
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ def test_zero_queries():
19
19
''' )
20
20
21
21
result = django_testdir .runpytest_subprocess ()
22
- assert 'tests with most queries' not in result .stdout .str ()
22
+ assert 'top tests with most queries' not in result .stdout .str ()
23
23
24
24
def test_querycount_report_lines (self , django_testdir ):
25
25
django_testdir .create_test_module ('''
@@ -52,14 +52,14 @@ def test_zero_queries():
52
52
assert True
53
53
''' )
54
54
55
- result = django_testdir .runpytest_subprocess ('--querycount=3 ' )
55
+ result = django_testdir .runpytest_subprocess ('--querycount=4 ' )
56
56
lines = result .stdout .get_lines_after (
57
- '*top 3 tests with most queries*'
57
+ '*top 4 tests with most queries*'
58
58
)
59
59
assert 'test_two_queries' in lines [0 ]
60
60
assert 'test_one_query' in lines [1 ]
61
61
assert 'test_failed' in lines [2 ]
62
- assert 'test_zero_queries' not in result . stdout . str ()
62
+ assert 'test_zero_queries' in lines [ 3 ]
63
63
64
64
def test_report_all_lines_on_querycount_zero (self , django_testdir ):
65
65
django_testdir .create_test_module ('''
You can’t perform that action at this time.
0 commit comments