File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -543,7 +543,7 @@ Running MongoDB tests against a live MongoDB instance
543543
544544 # Test MongoDB only
545545 ./scripts/test-local.sh mongo
546-
546+
547547 # Test MongoDB with local backends
548548 ./scripts/test-local.sh mongo memory pickle
549549
Original file line number Diff line number Diff line change @@ -177,7 +177,6 @@ The script automatically sets the required environment variables:
177177 docker rm cachier-test-mongo cachier-test-redis cachier-test-postgres
178178 ```
179179
180-
181180## Best Practices
182181
1831821 . ** Before committing** : Run ` ./scripts/test-local.sh external ` to test all external backends
Original file line number Diff line number Diff line change 66@pytest .fixture (scope = "session" , autouse = True )
77def cleanup_mongo_clients ():
88 """Clean up any MongoDB clients created during tests.
9-
9+
1010 This fixture runs automatically after all tests complete.
11+
1112 """
1213 # Let tests run
1314 yield
14-
15+
1516 # Cleanup after all tests
1617 try :
1718 from tests .test_mongo_core import _test_mongetter
19+
1820 if hasattr (_test_mongetter , "client" ):
1921 # Close the MongoDB client to avoid ResourceWarning
2022 _test_mongetter .client .close ()
2123 # Remove the client attribute so future test runs start fresh
2224 delattr (_test_mongetter , "client" )
2325 except (ImportError , AttributeError ):
2426 # If the module wasn't imported or client wasn't created, nothing to clean up
25- pass
27+ pass
Original file line number Diff line number Diff line change 2525 import pymongo
2626 from pymongo .errors import OperationFailure
2727 from pymongo .mongo_client import MongoClient
28+
2829 from cachier .cores .mongo import MissingMongetter
2930except (ImportError , ModuleNotFoundError ):
3031 print ("pymongo is not installed; tests requiring pymongo will fail!" )
You can’t perform that action at this time.
0 commit comments