Code Duplication    Length = 12-14 lines in 7 locations

tests/milvus_python_test/test_index.py 3 locations

@@ 1836-1849 (lines=14) @@
1833
                pytest.skip("ivfpq not support in GPU mode")
1834
        return request.param
1835
1836
    @pytest.fixture(
1837
        scope="function",
1838
        params=gen_simple_index()
1839
    )
1840
    def get_simple_index(self, request, connect):
1841
        if str(connect._cmd("mode")[1]) == "CPU":
1842
            if request.param["index_type"] == IndexType.IVF_SQ8H:
1843
                pytest.skip("sq8h not support in CPU mode")
1844
        if str(connect._cmd("mode")[1]) == "GPU":
1845
            # if request.param["index_type"] == IndexType.IVF_PQ:
1846
            if request.param["index_type"] not in [IndexType.IVF_FLAT]:
1847
                # pytest.skip("ivfpq not support in GPU mode")
1848
                pytest.skip("debug ivf_flat in GPU mode")
1849
        return request.param
1850
1851
    def check_status(self, status):
1852
        logging.getLogger().info("In callback check status")
@@ 1243-1254 (lines=12) @@
1240
                pytest.skip("ivfpq not support in GPU mode")
1241
        return request.param
1242
1243
    @pytest.fixture(
1244
        scope="function",
1245
        params=gen_simple_index()
1246
    )
1247
    def get_simple_index(self, request, connect):
1248
        if str(connect._cmd("mode")[1]) == "CPU":
1249
            if request.param["index_type"] == IndexType.IVF_SQ8H:
1250
                pytest.skip("sq8h not support in CPU mode")
1251
        if str(connect._cmd("mode")[1]) == "GPU":
1252
            if request.param["index_type"] == IndexType.IVF_PQ:
1253
                pytest.skip("ivfpq not support in GPU mode")
1254
        return request.param
1255
1256
    @pytest.fixture(
1257
        scope="function",
@@ 42-53 (lines=12) @@
39
                pytest.skip("ivfpq not support in GPU mode")
40
        return request.param
41
42
    @pytest.fixture(
43
        scope="function",
44
        params=gen_simple_index()
45
    )
46
    def get_simple_index(self, request, connect):
47
        if str(connect._cmd("mode")[1]) == "CPU":
48
            if request.param["index_type"] == IndexType.IVF_SQ8H:
49
                pytest.skip("sq8h not support in CPU mode")
50
        if str(connect._cmd("mode")[1]) == "GPU":
51
            if request.param["index_type"] == IndexType.IVF_PQ:
52
                pytest.skip("ivfpq not support in GPU mode")
53
        return request.param
54
55
    """
56
    ******************************************************************

tests/milvus_python_test/entity/test_delete.py 2 locations

@@ 295-306 (lines=12) @@
292
      The following cases are used to test `delete_entity_by_id` function
293
    ******************************************************************
294
    """
295
    @pytest.fixture(
296
        scope="function",
297
        params=gen_simple_index()
298
    )
299
    def get_simple_index(self, request, connect):
300
        if str(connect._cmd("mode")[1]) == "GPU":
301
            if request.param["index_type"] not in [IndexType.IVF_SQ8, IndexType.IVFLAT, IndexType.FLAT, IndexType.IVF_PQ, IndexType.IVF_SQ8H]:
302
                pytest.skip("Only support index_type: idmap/ivf")
303
        elif str(connect._cmd("mode")[1]) == "CPU":
304
            if request.param["index_type"] in [IndexType.IVF_SQ8H]:
305
                pytest.skip("CPU not support index_type: ivf_sq8h")
306
        return request.param
307
308
    def test_delete_vectors_after_index_created_search(self, connect, collection, get_simple_index):
309
        '''
@@ 29-40 (lines=12) @@
26
    ******************************************************************
27
    """
28
29
    @pytest.fixture(
30
        scope="function",
31
        params=gen_simple_index()
32
    )
33
    def get_simple_index(self, request, connect):
34
        if str(connect._cmd("mode")[1]) == "GPU":
35
            if request.param["index_type"] not in [IndexType.IVF_SQ8, IndexType.IVFLAT, IndexType.FLAT, IndexType.IVF_PQ, IndexType.IVF_SQ8H]:
36
                pytest.skip("Only support index_type: idmap/ivf")
37
        elif str(connect._cmd("mode")[1]) == "CPU":
38
            if request.param["index_type"] in [IndexType.IVF_SQ8H]:
39
                pytest.skip("CPU not support index_type: ivf_sq8h")
40
        return request.param
41
42
    def test_delete_vector_search(self, connect, collection, get_simple_index):
43
        '''

tests/milvus_python_test/entity/test_get_entity_by_id.py 1 location

@@ 237-249 (lines=13) @@
234
      The following cases are used to test .get_entity_by_id` function
235
    ******************************************************************
236
    """
237
    @pytest.fixture(
238
        scope="function",
239
        params=gen_simple_index()
240
    )
241
    def get_simple_index(self, request, connect):
242
        if str(connect._cmd("mode")[1]) == "GPU":
243
            if request.param["index_type"] not in [IndexType.IVF_SQ8, IndexType.IVFLAT, IndexType.FLAT, IndexType.IVF_PQ, IndexType.IVF_SQ8H]:
244
                pytest.skip("Only support index_type: idmap/ivf")
245
        elif str(connect._cmd("mode")[1]) == "CPU":
246
            if request.param["index_type"] in [IndexType.IVF_SQ8H]:
247
                pytest.skip("CPU not support index_type: ivf_sq8h")
248
249
        return request.param
250
251
    @pytest.fixture(
252
        scope="function",

tests/milvus_python_test/entity/test_search.py 1 location

@@ 1297-1308 (lines=12) @@
1294
                status, result = connect.search(collection, top_k, query_vecs, params=search_param)
1295
                assert status.OK()
1296
1297
    @pytest.fixture(
1298
        scope="function",
1299
        params=gen_simple_index()
1300
    )
1301
    def get_simple_index(self, request, connect):
1302
        if str(connect._cmd("mode")[1]) == "CPU":
1303
            if request.param["index_type"] == IndexType.IVF_SQ8H:
1304
                pytest.skip("sq8h not support in CPU mode")
1305
        if str(connect._cmd("mode")[1]) == "GPU":
1306
            if request.param["index_type"] == IndexType.IVF_PQ:
1307
                pytest.skip("ivfpq not support in GPU mode")
1308
        return request.param
1309
1310
    def test_search_with_empty_params(self, connect, collection, args, get_simple_index):
1311
        '''