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
17
+
16
18
try :
17
19
import django
18
20
except ImportError as e :
60
62
61
63
RUNTESTS_DIR = os .path .abspath (os .path .dirname (__file__ ))
62
64
65
+ MONGODB_TEST_DIR = Path (django_mongodb .__file__ ).parent .parent / "tests"
66
+ sys .path .append (str (MONGODB_TEST_DIR ))
67
+
63
68
TEMPLATE_DIR = os .path .join (RUNTESTS_DIR , "templates" )
64
69
65
70
# Create a specific subdirectory for the duration of the test suite.
@@ -142,6 +147,21 @@ def get_test_modules(gis_enabled):
142
147
test_module = dirname + "." + test_module
143
148
yield test_module
144
149
150
+ # Discover tests in django_mongodb/tests.
151
+ dirpath = os .path .join (MONGODB_TEST_DIR , dirname )
152
+ with os .scandir (dirpath ) as entries :
153
+ for f in entries :
154
+ if (
155
+ "." in f .name
156
+ or f .is_file ()
157
+ or not os .path .exists (os .path .join (f .path , "__init__.py" ))
158
+ ):
159
+ continue
160
+ test_module = f .name
161
+ if dirname :
162
+ test_module = dirname + "." + test_module
163
+ yield test_module
164
+
145
165
146
166
def get_label_module (label ):
147
167
"""Return the top-level module part for a test label."""
You can’t perform that action at this time.
0 commit comments