File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -432,6 +432,18 @@ def get_query_count(report):
432
432
nodeid = nodeid
433
433
))
434
434
435
+ import django
436
+ major , minor = django .VERSION [0 :2 ]
437
+
438
+ terminalreporter .write_line ('' )
439
+ terminalreporter .write_line (
440
+ '-- Docs: https://docs.djangoproject.com'
441
+ '/en/{major}.{minor}/topics/db/optimization/' .format (
442
+ major = major ,
443
+ minor = minor
444
+ )
445
+ )
446
+
435
447
436
448
@pytest .fixture (autouse = True , scope = 'session' )
437
449
def django_test_environment (request ):
Original file line number Diff line number Diff line change @@ -32,6 +32,30 @@ def test_zero_queries():
32
32
)
33
33
assert 'tests with most queries' not in result .stdout .str ()
34
34
35
+ def test_query_optimization_tips_for_the_current_version_of_django (
36
+ self ,
37
+ django_testdir
38
+ ):
39
+ django_testdir .create_test_module ('''
40
+ def test_zero_queries():
41
+ pass
42
+ ''' )
43
+
44
+ result = django_testdir .runpytest_subprocess ('--querycount=5' )
45
+
46
+ import django
47
+ major , minor = django .VERSION [0 :2 ]
48
+
49
+ url = (
50
+ 'https://docs.djangoproject.com'
51
+ '/en/{major}.{minor}/topics/db/optimization/'
52
+ ).format (
53
+ major = major ,
54
+ minor = minor
55
+ )
56
+
57
+ assert url in result .stdout .str ()
58
+
35
59
def test_querycount_report_lines (self , django_testdir ):
36
60
django_testdir .create_test_module ('''
37
61
import pytest
You can’t perform that action at this time.
0 commit comments