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 @@ -413,6 +413,18 @@ def get_query_count(report):
413
413
nodeid = nodeid
414
414
))
415
415
416
+ import django
417
+ major , minor = django .VERSION [0 :2 ]
418
+
419
+ terminalreporter .write_line ('' )
420
+ terminalreporter .write_line (
421
+ '-- Docs: https://docs.djangoproject.com'
422
+ '/en/{major}.{minor}/topics/db/optimization/' .format (
423
+ major = major ,
424
+ minor = minor
425
+ )
426
+ )
427
+
416
428
417
429
@pytest .fixture (autouse = True , scope = 'session' )
418
430
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