1414import pymongo
1515import pytest
1616from birch import Birch # type: ignore[import-not-found]
17- from cachier import cachier
18- from cachier .cores .base import RecalculationNeeded
19- from cachier .cores .mongo import _MongoCore
2017from pymongo .errors import OperationFailure
2118from pymongo .mongo_client import MongoClient
2219from pymongo_inmemory import MongoClient as InMemoryMongoClient
2320
21+ from cachier import cachier
22+ from cachier .cores .base import RecalculationNeeded
23+ from cachier .cores .mongo import _MongoCore
24+
2425# === Enables testing vs a real MongoDB instance ===
2526
2627
@@ -76,13 +77,13 @@ def _test_mongetter():
7677# === Mongo core tests ===
7778
7879
79- @pytest .mark .mongo ()
80+ @pytest .mark .mongo
8081def test_information ():
8182 print ("\n pymongo version: " , end = "" )
8283 print (pymongo .__version__ )
8384
8485
85- @pytest .mark .mongo ()
86+ @pytest .mark .mongo
8687def test_mongo_index_creation ():
8788 """Basic Mongo core functionality."""
8889
@@ -99,7 +100,7 @@ def _test_mongo_caching(arg_1, arg_2):
99100 assert _MongoCore ._INDEX_NAME in collection .index_information ()
100101
101102
102- @pytest .mark .mongo ()
103+ @pytest .mark .mongo
103104def test_mongo_core ():
104105 """Basic Mongo core functionality."""
105106
@@ -122,7 +123,7 @@ def _test_mongo_caching(arg_1, arg_2):
122123 assert val6 == val5
123124
124125
125- @pytest .mark .mongo ()
126+ @pytest .mark .mongo
126127def test_mongo_core_keywords ():
127128 """Basic Mongo core functionality with keyword arguments."""
128129
@@ -145,7 +146,7 @@ def _test_mongo_caching(arg_1, arg_2):
145146 assert val6 == val5
146147
147148
148- @pytest .mark .mongo ()
149+ @pytest .mark .mongo
149150def test_mongo_stale_after ():
150151 """Testing MongoDB core stale_after functionality."""
151152
@@ -178,7 +179,7 @@ def _takes_time(arg_1, arg_2):
178179 res_queue .put (res )
179180
180181
181- @pytest .mark .mongo ()
182+ @pytest .mark .mongo
182183def test_mongo_being_calculated ():
183184 """Testing MongoDB core handling of being calculated scenarios."""
184185
@@ -228,7 +229,7 @@ def _bad_mongetter():
228229 return _BadMongoCollection (_test_mongetter )
229230
230231
231- @pytest .mark .mongo ()
232+ @pytest .mark .mongo
232233def test_mongo_write_failure ():
233234 """Testing MongoDB core handling of writing failure scenarios."""
234235
@@ -244,7 +245,7 @@ def _func_w_bad_mongo(arg_1, arg_2):
244245 # assert val1 == val2
245246
246247
247- @pytest .mark .mongo ()
248+ @pytest .mark .mongo
248249def test_mongo_clear_being_calculated ():
249250 """Testing MongoDB core clear_being_calculated."""
250251
@@ -256,7 +257,7 @@ def _func_w_bad_mongo(arg_1, arg_2):
256257 _func_w_bad_mongo .clear_being_calculated ()
257258
258259
259- @pytest .mark .mongo ()
260+ @pytest .mark .mongo
260261def test_stalled_mongo_db_cache ():
261262 @cachier (mongetter = _test_mongetter )
262263 def _stalled_func ():
@@ -269,7 +270,7 @@ def _stalled_func():
269270 core .wait_on_entry_calc (key = None )
270271
271272
272- @pytest .mark .mongo ()
273+ @pytest .mark .mongo
273274def test_stalled_mong_db_core (monkeypatch ):
274275 def mock_get_entry (self , args , kwargs ):
275276 return "key" , {"being_calculated" : True }
@@ -325,7 +326,7 @@ def _stalled_func_3():
325326 assert res == 1
326327
327328
328- @pytest .mark .mongo ()
329+ @pytest .mark .mongo
329330def test_callable_hash_param ():
330331 def _hash_func (args , kwargs ):
331332 def _hash (obj ):
0 commit comments