|
22 | 22 | from typing import cast |
23 | 23 |
|
24 | 24 | import pytest |
25 | | -from pymilvus import CollectionSchema |
26 | | -from pymilvus import DataType |
27 | | -from pymilvus import FieldSchema |
28 | | -from pymilvus import MilvusClient |
29 | | -from pymilvus.exceptions import MilvusException |
30 | | -from pymilvus.milvus_client import IndexParams |
31 | 25 |
|
32 | 26 | import apache_beam as beam |
33 | 27 | from apache_beam.ml.rag.ingestion.jdbc_common import WriteConfig |
|
41 | 35 | from apache_beam.ml.rag.utils import unpack_dataclass_with_kwargs |
42 | 36 | from apache_beam.testing.test_pipeline import TestPipeline |
43 | 37 |
|
| 38 | +# pylint: disable=wrong-import-order, wrong-import-position, ungrouped-imports |
44 | 39 | try: |
| 40 | + from pymilvus import CollectionSchema |
| 41 | + from pymilvus import DataType |
| 42 | + from pymilvus import FieldSchema |
| 43 | + from pymilvus import MilvusClient |
| 44 | + from pymilvus.exceptions import MilvusException |
| 45 | + from pymilvus.milvus_client import IndexParams |
| 46 | + |
45 | 47 | from apache_beam.ml.rag.ingestion.milvus_search import MilvusVectorWriterConfig |
46 | 48 | from apache_beam.ml.rag.ingestion.milvus_search import MilvusWriteConfig |
47 | | -except ImportError as e: |
48 | | - raise unittest.SkipTest(f'Milvus dependencies not installed: {str(e)}') |
| 49 | + PYMILVUS_AVAILABLE = True |
| 50 | +except ImportError: |
| 51 | + PYMILVUS_AVAILABLE = False |
| 52 | +# pylint: enable=wrong-import-order, wrong-import-position, ungrouped-imports |
49 | 53 |
|
50 | 54 |
|
51 | 55 | def _construct_index_params(): |
@@ -158,6 +162,7 @@ def drop_collection(client: MilvusClient, collection_name: str): |
158 | 162 |
|
159 | 163 |
|
160 | 164 | @pytest.mark.require_docker_in_docker |
| 165 | +@unittest.skipIf(not PYMILVUS_AVAILABLE, 'pymilvus is not installed.') |
161 | 166 | @unittest.skipUnless( |
162 | 167 | platform.system() == "Linux", |
163 | 168 | "Test runs only on Linux due to lack of support, as yet, for nested " |
|
0 commit comments