(request)
| 57 | |
| 58 | @pytest.fixture(scope="function") |
| 59 | def vecdb(request) -> VectorStore: |
| 60 | # Unique suffix per pytest-xdist worker so parallel workers don't collide |
| 61 | # on the same Qdrant collection in the shared local container (PR #1030). |
| 62 | worker = os.environ.get("PYTEST_XDIST_WORKER", "main") |
| 63 | if request.param == "qdrant_local": |
| 64 | qd_dir = ":memory:" |
| 65 | qd_cfg = QdrantDBConfig( |
| 66 | cloud=False, |
| 67 | collection_name="test-" + embed_cfg.model_type, |
| 68 | storage_path=qd_dir, |
| 69 | embedding=embed_cfg, |
| 70 | ) |
| 71 | qd = QdrantDB(qd_cfg) |
| 72 | qd.add_documents(stored_docs) |
| 73 | yield qd |
| 74 | return |
| 75 | |
| 76 | if request.param == "qdrant_cloud": |
| 77 | qd_dir = ".qdrant/cloud/" + embed_cfg.model_type |
| 78 | qd_cfg_cloud = QdrantDBConfig( |
| 79 | cloud=True, |
| 80 | collection_name=f"test-{embed_cfg.model_type}-{worker}", |
| 81 | storage_path=qd_dir, |
| 82 | embedding=embed_cfg, |
| 83 | ) |
| 84 | qd_cloud = QdrantDB(qd_cfg_cloud) |
| 85 | qd_cloud.add_documents(stored_docs) |
| 86 | yield qd_cloud |
| 87 | qd_cloud.delete_collection(collection_name=qd_cfg_cloud.collection_name) |
| 88 | return |
| 89 | if request.param == "weaviate_cloud": |
| 90 | wv_cfg_cloud = WeaviateDBConfig( |
| 91 | collection_name="test_" + embed_cfg.model_type, |
| 92 | embedding=embed_cfg, |
| 93 | cloud=True, |
| 94 | ) |
| 95 | weaviate_cloud = WeaviateDB(wv_cfg_cloud) |
| 96 | weaviate_cloud.add_documents(stored_docs) |
| 97 | yield weaviate_cloud |
| 98 | weaviate_cloud.delete_collection(collection_name=wv_cfg_cloud.collection_name) |
| 99 | return |
| 100 | if request.param == "weaviate_local": |
| 101 | wv_dir = ".weaviate/" + embed_cfg.model_type |
| 102 | rmdir(wv_dir) |
| 103 | |
| 104 | wv_cfg_local = WeaviateDBConfig( |
| 105 | collection_name="test_" + embed_cfg.model_type, |
| 106 | embedding=embed_cfg, |
| 107 | cloud=False, |
| 108 | docker=False, |
| 109 | storage_path=wv_dir, |
| 110 | ) |
| 111 | weaviate_local = WeaviateDB(wv_cfg_local) |
| 112 | weaviate_local.add_documents(stored_docs) |
| 113 | yield weaviate_local |
| 114 | weaviate_local.delete_collection(collection_name=wv_cfg_local.collection_name) |
| 115 | rmdir(wv_dir) |
| 116 | return |
nothing calls this directly
no test coverage detected
searching dependent graphs…