66from django .conf import settings
77from django .test .utils import get_runner
88
9- from clickhouse_backend . compat import dj_ge4
9+ from clickhouse_backend import compat
1010
1111RUNTESTS_DIR = os .path .abspath (os .path .dirname (__file__ ))
1212SKIP_DIRS = ["unsupported" ]
@@ -31,12 +31,13 @@ def get_test_modules():
3131
3232# assertQuerysetEqual is removed from django 5.1
3333def patch_assertQuerysetEqual ():
34- from django .test import TransactionTestCase
34+ if compat .dj_ge5 :
35+ from django .test import TransactionTestCase
3536
36- def assertQuerysetEqual (self , * args , ** kw ):
37- return self .assertQuerySetEqual (* args , ** kw )
37+ def assertQuerysetEqual (self , * args , ** kw ):
38+ return self .assertQuerySetEqual (* args , ** kw )
3839
39- TransactionTestCase .assertQuerysetEqual = assertQuerysetEqual
40+ TransactionTestCase .assertQuerysetEqual = assertQuerysetEqual
4041
4142
4243if __name__ == "__main__" :
@@ -78,7 +79,7 @@ def assertQuerysetEqual(self, *args, **kw):
7879 action = "store_true" ,
7980 help = "Turn on the SQL query logger within tests." ,
8081 )
81- if not dj_ge4 :
82+ if not compat . dj_ge4 :
8283 from django .test .runner import default_test_processes
8384
8485 parser .add_argument (
@@ -114,7 +115,7 @@ def assertQuerysetEqual(self, *args, **kw):
114115 django .setup ()
115116
116117 parallel = options .parallel
117- if dj_ge4 and parallel in {0 , "auto" }:
118+ if compat . dj_ge4 and parallel in {0 , "auto" }:
118119 # This doesn't work before django.setup() on some databases.
119120 from django .db import connections
120121 from django .test .runner import get_max_test_processes
0 commit comments