Skip to content

Commit 6effbea

Browse files
committed
Improve: Fewer PyTest runs
1 parent 08c7ac0 commit 6effbea

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

scripts/test.py

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ def test_invalid_argument_handling(function, expected_error, args, kwargs):
588588

589589

590590
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
591-
@pytest.mark.repeat(50)
591+
@pytest.mark.repeat(5)
592592
@pytest.mark.parametrize("ndim", [11, 97, 1536])
593593
@pytest.mark.parametrize("dtype", ["float64", "float32", "float16"])
594594
@pytest.mark.parametrize("metric", ["inner", "euclidean", "sqeuclidean", "cosine"])
@@ -617,7 +617,7 @@ def test_dense(ndim, dtype, metric, capability, stats_fixture):
617617

618618

619619
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
620-
@pytest.mark.repeat(50)
620+
@pytest.mark.repeat(5)
621621
@pytest.mark.parametrize("ndim", [11, 97])
622622
@pytest.mark.parametrize(
623623
"dtypes", # representation datatype and compute precision
@@ -674,7 +674,7 @@ def test_curved(ndim, dtypes, metric, capability, stats_fixture):
674674

675675
@pytest.mark.skipif(is_running_under_qemu(), reason="Complex math in QEMU fails")
676676
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
677-
@pytest.mark.repeat(50)
677+
@pytest.mark.repeat(5)
678678
@pytest.mark.parametrize("ndim", [11, 97])
679679
@pytest.mark.parametrize("dtype", ["complex128", "complex64"])
680680
@pytest.mark.parametrize("capability", possible_capabilities)
@@ -707,7 +707,7 @@ def test_curved_complex(ndim, dtype, capability, stats_fixture):
707707

708708

709709
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
710-
@pytest.mark.repeat(50)
710+
@pytest.mark.repeat(5)
711711
@pytest.mark.parametrize("ndim", [11, 97, 1536])
712712
@pytest.mark.parametrize("metric", ["inner", "euclidean", "sqeuclidean", "cosine"])
713713
@pytest.mark.parametrize("capability", possible_capabilities)
@@ -747,7 +747,7 @@ def test_dense_bf16(ndim, metric, capability, stats_fixture):
747747

748748

749749
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
750-
@pytest.mark.repeat(50)
750+
@pytest.mark.repeat(5)
751751
@pytest.mark.parametrize("ndim", [11, 16, 33])
752752
@pytest.mark.parametrize("metric", ["bilinear", "mahalanobis"])
753753
@pytest.mark.parametrize("capability", possible_capabilities)
@@ -806,7 +806,7 @@ def test_curved_bf16(ndim, metric, capability, stats_fixture):
806806

807807

808808
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
809-
@pytest.mark.repeat(50)
809+
@pytest.mark.repeat(5)
810810
@pytest.mark.parametrize("ndim", [11, 97, 1536])
811811
@pytest.mark.parametrize("dtype", ["int8", "uint8"])
812812
@pytest.mark.parametrize("metric", ["inner", "euclidean", "sqeuclidean", "cosine"])
@@ -852,7 +852,7 @@ def test_dense_i8(ndim, dtype, metric, capability, stats_fixture):
852852

853853
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
854854
@pytest.mark.skipif(not scipy_available, reason="SciPy is not installed")
855-
@pytest.mark.repeat(50)
855+
@pytest.mark.repeat(5)
856856
@pytest.mark.parametrize("ndim", [11, 97, 1536])
857857
@pytest.mark.parametrize("metric", ["jaccard", "hamming"])
858858
@pytest.mark.parametrize("capability", possible_capabilities)
@@ -883,7 +883,7 @@ def test_dense_bits(ndim, metric, capability, stats_fixture):
883883

884884
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
885885
@pytest.mark.skipif(not scipy_available, reason="SciPy is not installed")
886-
@pytest.mark.repeat(50)
886+
@pytest.mark.repeat(5)
887887
@pytest.mark.parametrize("ndim", [11, 97, 1536])
888888
@pytest.mark.parametrize("dtype", ["float32", "float16"])
889889
@pytest.mark.parametrize("capability", possible_capabilities)
@@ -937,7 +937,7 @@ def test_cosine_zero_vector(ndim, dtype, capability):
937937

938938
@pytest.mark.skip(reason="Lacks overflow protection: https://github.com/ashvardanian/SimSIMD/issues/206") # TODO
939939
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
940-
@pytest.mark.repeat(50)
940+
@pytest.mark.repeat(5)
941941
@pytest.mark.parametrize("ndim", [11, 97, 1536])
942942
@pytest.mark.parametrize("dtype", ["float64", "float32", "float16"])
943943
@pytest.mark.parametrize("metric", ["inner", "euclidean", "sqeuclidean", "cosine"])
@@ -971,7 +971,7 @@ def test_overflow(ndim, dtype, metric, capability):
971971

972972
@pytest.mark.skip(reason="Lacks overflow protection: https://github.com/ashvardanian/SimSIMD/issues/206") # TODO
973973
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
974-
@pytest.mark.repeat(50)
974+
@pytest.mark.repeat(5)
975975
@pytest.mark.parametrize("ndim", [131072, 262144])
976976
@pytest.mark.parametrize("metric", ["inner", "euclidean", "sqeuclidean", "cosine"])
977977
@pytest.mark.parametrize("capability", possible_capabilities)
@@ -1001,7 +1001,7 @@ def test_overflow_i8(ndim, metric, capability):
10011001

10021002
@pytest.mark.skipif(is_running_under_qemu(), reason="Complex math in QEMU fails")
10031003
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
1004-
@pytest.mark.repeat(50)
1004+
@pytest.mark.repeat(5)
10051005
@pytest.mark.parametrize("ndim", [11, 97, 1536])
10061006
@pytest.mark.parametrize("dtype", ["complex128", "complex64"])
10071007
@pytest.mark.parametrize("capability", possible_capabilities)
@@ -1018,23 +1018,19 @@ def test_dot_complex(ndim, dtype, capability, stats_fixture):
10181018
result = np.array(result)
10191019

10201020
np.testing.assert_allclose(result, expected, atol=SIMSIMD_ATOL, rtol=SIMSIMD_RTOL)
1021-
collect_errors(
1022-
"dot", ndim, dtype, accurate, accurate_dt, expected, expected_dt, result, result_dt, stats_fixture
1023-
)
1021+
collect_errors("dot", ndim, dtype, accurate, accurate_dt, expected, expected_dt, result, result_dt, stats_fixture)
10241022

10251023
accurate_dt, accurate = profile(np.vdot, a.astype(np.complex128), b.astype(np.complex128))
10261024
expected_dt, expected = profile(np.vdot, a, b)
10271025
result_dt, result = profile(simd.vdot, a, b)
10281026
result = np.array(result)
10291027

10301028
np.testing.assert_allclose(result, expected, atol=SIMSIMD_ATOL, rtol=SIMSIMD_RTOL)
1031-
collect_errors(
1032-
"vdot", ndim, dtype, accurate, accurate_dt, expected, expected_dt, result, result_dt, stats_fixture
1033-
)
1029+
collect_errors("vdot", ndim, dtype, accurate, accurate_dt, expected, expected_dt, result, result_dt, stats_fixture)
10341030

10351031

10361032
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
1037-
@pytest.mark.repeat(100)
1033+
@pytest.mark.repeat(5)
10381034
@pytest.mark.parametrize("dtype", ["uint16", "uint32"])
10391035
@pytest.mark.parametrize("first_length_bound", [10, 100, 1000])
10401036
@pytest.mark.parametrize("second_length_bound", [10, 100, 1000])
@@ -1064,7 +1060,7 @@ def test_intersect(dtype, first_length_bound, second_length_bound, capability):
10641060

10651061

10661062
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
1067-
@pytest.mark.repeat(50)
1063+
@pytest.mark.repeat(5)
10681064
@pytest.mark.parametrize("ndim", [11, 97, 1536])
10691065
@pytest.mark.parametrize("dtype", ["float64", "float32", "float16", "int8", "uint8"])
10701066
@pytest.mark.parametrize("kernel", ["fma"])
@@ -1125,7 +1121,7 @@ def test_fma(ndim, dtype, kernel, capability, stats_fixture):
11251121

11261122

11271123
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
1128-
@pytest.mark.repeat(50)
1124+
@pytest.mark.repeat(5)
11291125
@pytest.mark.parametrize("ndim", [11, 97, 1536])
11301126
@pytest.mark.parametrize("dtype", ["float64", "float32", "float16", "int8", "uint8"])
11311127
@pytest.mark.parametrize("kernel", ["wsum"])
@@ -1395,7 +1391,7 @@ def test_cdist_complex(ndim, input_dtype, out_dtype, metric, capability):
13951391

13961392
@pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")
13971393
@pytest.mark.skipif(not scipy_available, reason="SciPy is not installed")
1398-
@pytest.mark.repeat(50)
1394+
@pytest.mark.repeat(5)
13991395
@pytest.mark.parametrize("ndim", [11, 97, 1536])
14001396
@pytest.mark.parametrize("out_dtype", [None, "float32", "float16", "int8"])
14011397
@pytest.mark.parametrize("capability", possible_capabilities)

0 commit comments

Comments
 (0)