Skip to content

Commit 479d094

Browse files
committed
Add skip flag.
1 parent 2bcd07e commit 479d094

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

django_mongodb_backend/expressions/builtins.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ def col(self, compiler, connection, as_path=False): # noqa: ARG001
7474
return f"{prefix}{self.target.column}" if as_path else f"${prefix}{self.target.column}"
7575

7676

77-
def col_as_path(self, compiler, connection):
78-
return col(self, compiler, connection).lstrip("$")
79-
80-
8177
def col_pairs(self, compiler, connection):
8278
cols = self.get_cols()
8379
if len(cols) > 1:

tests/queries_/test_search.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from django.db import connection
66
from django.db.utils import DatabaseError
7-
from django.test import TransactionTestCase
7+
from django.test import TransactionTestCase, skipUnlessDBFeature
88
from pymongo.operations import SearchIndexModel
99

1010
from django_mongodb_backend.expressions.search import (
@@ -65,6 +65,7 @@ def _inner_wait_loop(predicate: Callable):
6565
return _inner_wait_loop
6666

6767

68+
@skipUnlessDBFeature("supports_atlas_search")
6869
class SearchUtilsMixin(TransactionTestCase):
6970
available_apps = []
7071

@@ -87,6 +88,7 @@ def _tear_down(self, model):
8788
wait_for_assertion = _wait_for_assertion(timeout=3)
8889

8990

91+
@skipUnlessDBFeature("supports_atlas_search")
9092
class SearchEqualsTest(SearchUtilsMixin):
9193
def setUp(self):
9294
self.create_search_index(
@@ -105,6 +107,7 @@ def test_search_equals(self):
105107
self.wait_for_assertion(lambda: self.assertCountEqual(qs.all(), [self.article]))
106108

107109

110+
@skipUnlessDBFeature("supports_atlas_search")
108111
class SearchAutocompleteTest(SearchUtilsMixin):
109112
def setUp(self):
110113
self.create_search_index(
@@ -168,6 +171,7 @@ def test_search_autocomplete_embedded_model(self):
168171
self.wait_for_assertion(lambda: self.assertCountEqual(qs.all(), [self.article]))
169172

170173

174+
@skipUnlessDBFeature("supports_atlas_search")
171175
class SearchExistsTest(SearchUtilsMixin):
172176
def setUp(self):
173177
self.create_search_index(
@@ -182,6 +186,7 @@ def test_search_exists(self):
182186
self.wait_for_assertion(lambda: self.assertCountEqual(qs.all(), [self.article]))
183187

184188

189+
@skipUnlessDBFeature("supports_atlas_search")
185190
class SearchInTest(SearchUtilsMixin):
186191
def setUp(self):
187192
self.create_search_index(
@@ -201,6 +206,7 @@ def test_search_in(self):
201206
self.wait_for_assertion(lambda: self.assertCountEqual(qs.all(), [self.cross]))
202207

203208

209+
@skipUnlessDBFeature("supports_atlas_search")
204210
class SearchPhraseTest(SearchUtilsMixin):
205211
def setUp(self):
206212
self.create_search_index(
@@ -221,6 +227,7 @@ def test_search_phrase(self):
221227
self.wait_for_assertion(lambda: self.assertCountEqual(qs.all(), [self.irrelevant]))
222228

223229

230+
@skipUnlessDBFeature("supports_atlas_search")
224231
class SearchRangeTest(SearchUtilsMixin):
225232
def setUp(self):
226233
self.create_search_index(
@@ -240,6 +247,7 @@ def test_search_range(self):
240247
self.wait_for_assertion(lambda: self.assertCountEqual(qs.all(), [self.number20]))
241248

242249

250+
@skipUnlessDBFeature("supports_atlas_search")
243251
class SearchRegexTest(SearchUtilsMixin):
244252
def setUp(self):
245253
self.create_search_index(
@@ -265,6 +273,7 @@ def test_search_regex(self):
265273
self.wait_for_assertion(lambda: self.assertCountEqual(qs.all(), [self.article]))
266274

267275

276+
@skipUnlessDBFeature("supports_atlas_search")
268277
class SearchTextTest(SearchUtilsMixin):
269278
def setUp(self):
270279
self.create_search_index(
@@ -293,6 +302,7 @@ def test_search_text_with_fuzzy_and_criteria(self):
293302
self.wait_for_assertion(lambda: self.assertCountEqual(qs.all(), [self.article]))
294303

295304

305+
@skipUnlessDBFeature("supports_atlas_search")
296306
class SearchWildcardTest(SearchUtilsMixin):
297307
def setUp(self):
298308
self.create_search_index(
@@ -316,6 +326,7 @@ def test_search_wildcard(self):
316326
self.wait_for_assertion(lambda: self.assertCountEqual([self.article], qs))
317327

318328

329+
@skipUnlessDBFeature("supports_atlas_search")
319330
class SearchGeoShapeTest(SearchUtilsMixin):
320331
def setUp(self):
321332
self.create_search_index(
@@ -347,6 +358,7 @@ def test_search_geo_shape(self):
347358
self.wait_for_assertion(lambda: self.assertCountEqual(qs.all(), [self.article]))
348359

349360

361+
@skipUnlessDBFeature("supports_atlas_search")
350362
class SearchGeoWithinTest(SearchUtilsMixin):
351363
def setUp(self):
352364
self.create_search_index(
@@ -377,6 +389,7 @@ def test_search_geo_within(self):
377389
self.wait_for_assertion(lambda: self.assertCountEqual(qs.all(), [self.article]))
378390

379391

392+
@skipUnlessDBFeature("supports_atlas_search")
380393
@unittest.expectedFailure
381394
class SearchMoreLikeThisTest(SearchUtilsMixin):
382395
def setUp(self):
@@ -424,6 +437,7 @@ def test_search_more_like_this(self):
424437
)
425438

426439

440+
@skipUnlessDBFeature("supports_atlas_search")
427441
class CompoundSearchTest(SearchUtilsMixin):
428442
def setUp(self):
429443
self.create_search_index(
@@ -493,6 +507,7 @@ def test_compound_operations(self):
493507
)
494508

495509

510+
@skipUnlessDBFeature("supports_atlas_search")
496511
class SearchVectorTest(SearchUtilsMixin):
497512
def setUp(self):
498513
self.create_search_index(

0 commit comments

Comments
 (0)