File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 13
13
import warnings
14
14
from pathlib import Path
15
15
16
+ import django_mongodb_backend
17
+
16
18
try :
17
19
import django
18
20
except ImportError as e :
57
59
58
60
RUNTESTS_DIR = os .path .abspath (os .path .dirname (__file__ ))
59
61
62
+ MONGODB_TEST_DIR = Path (django_mongodb_backend .__file__ ).parent .parent / "tests"
63
+ sys .path .append (str (MONGODB_TEST_DIR ))
64
+
60
65
TEMPLATE_DIR = os .path .join (RUNTESTS_DIR , "templates" )
61
66
62
67
# Create a specific subdirectory for the duration of the test suite.
@@ -139,6 +144,21 @@ def get_test_modules(gis_enabled):
139
144
test_module = dirname + "." + test_module
140
145
yield test_module
141
146
147
+ # Discover tests in django_mongodb_backend/tests.
148
+ dirpath = os .path .join (MONGODB_TEST_DIR , dirname )
149
+ with os .scandir (dirpath ) as entries :
150
+ for f in entries :
151
+ if (
152
+ "." in f .name
153
+ or f .is_file ()
154
+ or not os .path .exists (os .path .join (f .path , "__init__.py" ))
155
+ ):
156
+ continue
157
+ test_module = f .name
158
+ if dirname :
159
+ test_module = dirname + "." + test_module
160
+ yield test_module
161
+
142
162
143
163
def get_label_module (label ):
144
164
"""Return the top-level module part for a test label."""
You can’t perform that action at this time.
0 commit comments