6
6
from django .conf import settings
7
7
from django .test .utils import get_runner
8
8
9
- from clickhouse_backend . compat import dj_ge4
9
+ from clickhouse_backend import compat
10
10
11
11
RUNTESTS_DIR = os .path .abspath (os .path .dirname (__file__ ))
12
12
SKIP_DIRS = ["unsupported" ]
@@ -31,12 +31,13 @@ def get_test_modules():
31
31
32
32
# assertQuerysetEqual is removed from django 5.1
33
33
def patch_assertQuerysetEqual ():
34
- from django .test import TransactionTestCase
34
+ if compat .dj_ge5 :
35
+ from django .test import TransactionTestCase
35
36
36
- def assertQuerysetEqual (self , * args , ** kw ):
37
- return self .assertQuerySetEqual (* args , ** kw )
37
+ def assertQuerysetEqual (self , * args , ** kw ):
38
+ return self .assertQuerySetEqual (* args , ** kw )
38
39
39
- TransactionTestCase .assertQuerysetEqual = assertQuerysetEqual
40
+ TransactionTestCase .assertQuerysetEqual = assertQuerysetEqual
40
41
41
42
42
43
if __name__ == "__main__" :
@@ -78,7 +79,7 @@ def assertQuerysetEqual(self, *args, **kw):
78
79
action = "store_true" ,
79
80
help = "Turn on the SQL query logger within tests." ,
80
81
)
81
- if not dj_ge4 :
82
+ if not compat . dj_ge4 :
82
83
from django .test .runner import default_test_processes
83
84
84
85
parser .add_argument (
@@ -114,7 +115,7 @@ def assertQuerysetEqual(self, *args, **kw):
114
115
django .setup ()
115
116
116
117
parallel = options .parallel
117
- if dj_ge4 and parallel in {0 , "auto" }:
118
+ if compat . dj_ge4 and parallel in {0 , "auto" }:
118
119
# This doesn't work before django.setup() on some databases.
119
120
from django .db import connections
120
121
from django .test .runner import get_max_test_processes
0 commit comments