Skip to content

Commit f1e1d53

Browse files
committed
Reduce test time
1 parent 067797e commit f1e1d53

4 files changed

Lines changed: 25 additions & 23 deletions

File tree

tests/ndarray/test_lazyexpr.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
from blosc2.lazyexpr import ne_evaluate
1717
from blosc2.ndarray import get_chunks_idx, npvecdot
1818

19-
NITEMS_SMALL = 1_000
20-
NITEMS = 10_000
19+
NITEMS_SMALL = 100
20+
NITEMS = 1000
2121

2222

2323
@pytest.fixture(params=[np.float32, np.float64])
2424
def dtype_fixture(request):
2525
return request.param
2626

2727

28-
@pytest.fixture(params=[(NITEMS_SMALL,), (NITEMS,), (NITEMS // 100, 100)])
28+
@pytest.fixture(params=[(NITEMS_SMALL,), (NITEMS,), (NITEMS // 10, 100)])
2929
def shape_fixture(request):
3030
return request.param
3131

@@ -36,7 +36,7 @@ def shape_fixture(request):
3636
(True, True),
3737
(True, False),
3838
pytest.param((False, True), marks=pytest.mark.heavy),
39-
(False, False),
39+
pytest.param((False, False), marks=pytest.mark.heavy),
4040
]
4141
)
4242
def chunks_blocks_fixture(request):
@@ -1811,9 +1811,9 @@ def test_simpleproxy(xp, dtype):
18111811
npa = blosc_matrix[()]
18121812
res = (npb & npa) | np.logical_not(npb)
18131813
else:
1814-
N = 10
1814+
N = 5
18151815
shape_a = (N, N, N)
1816-
blosc_matrix = blosc2.full(shape=shape_a, fill_value=3, dtype=np.dtype(dtype), chunks=(N // 3,) * 3)
1816+
blosc_matrix = blosc2.full(shape=shape_a, fill_value=3, dtype=np.dtype(dtype), chunks=(N // 2,) * 3)
18171817
foreign_matrix = xp.ones(shape_a, dtype=dtype_)
18181818
if dtype == "complex128":
18191819
foreign_matrix += 0.5j

tests/ndarray/test_lazyexpr_fields.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import blosc2
1313
from blosc2.lazyexpr import ne_evaluate
1414

15-
NITEMS_SMALL = 1_000
16-
NITEMS = 10_000
15+
NITEMS_SMALL = 100
16+
NITEMS = 1000
1717

1818

1919
@pytest.fixture(
@@ -41,7 +41,9 @@ def dtype_fixture(request):
4141
return request.param
4242

4343

44-
@pytest.fixture(params=[(NITEMS_SMALL,), (NITEMS,), (NITEMS // 100, 100)])
44+
@pytest.fixture(
45+
params=[(NITEMS_SMALL,), (NITEMS,), pytest.param((NITEMS // 10, 100), marks=pytest.mark.heavy)]
46+
)
4547
def shape_fixture(request):
4648
return request.param
4749

@@ -52,7 +54,7 @@ def shape_fixture(request):
5254
(True, True),
5355
(True, False),
5456
pytest.param((False, True), marks=pytest.mark.heavy),
55-
(False, False),
57+
pytest.param((False, False), marks=pytest.mark.heavy),
5658
]
5759
)
5860
def chunks_blocks_fixture(request):

tests/ndarray/test_linalg.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
((12, 10), (7, 5), (3, 3)),
1717
((10,), (9,), (7,)),
1818
((0,), (0,), (0,)),
19-
((40, 10, 10), (2, 3, 4), (1, 2, 2)),
19+
((4, 10, 10), (2, 3, 4), (1, 2, 2)),
2020
},
2121
)
2222
@pytest.mark.parametrize(
@@ -25,9 +25,9 @@
2525
((10,), (4,), (2,)),
2626
((10, 5), (3, 4), (1, 3)),
2727
((10, 12), (2, 4), (1, 2)),
28-
((200, 10, 22), (23, 2, 4), (4, 1, 2)),
28+
((3, 10, 3), (2, 2, 4), (1, 1, 2)),
2929
((0,), (0,), (0,)),
30-
((20, 40, 10, 10), (5, 2, 3, 4), (2, 1, 2, 2)),
30+
((6, 3, 10, 10), (5, 2, 3, 4), (2, 1, 2, 2)),
3131
},
3232
)
3333
@pytest.mark.parametrize(
@@ -302,13 +302,13 @@ def test_matmul_disk():
302302
),
303303
# 5Dx5D->no reduce
304304
(
305-
(3, 4, 5, 6, 7),
306-
(2, 3, 4, 5, 6),
307-
(1, 2, 2, 3, 3),
308-
(5, 6, 7, 4, 8),
309-
(4, 5, 6, 3, 7),
310-
(2, 3, 3, 2, 4),
311-
(2, 3, 4, 5, 6, 2, 3, 3, 2, 4), # output dims = 10
305+
(1, 2, 1, 5, 3),
306+
(1, 1, 1, 2, 2),
307+
(1, 1, 1, 1, 1),
308+
(2, 3, 2, 1, 5),
309+
(1, 2, 1, 1, 3),
310+
(1, 2, 1, 1, 1),
311+
(1, 2, 1, 2, 2, 2, 1, 2, 1, 3), # output dims = 10
312312
([], []),
313313
),
314314
],

tests/ndarray/test_ndarray.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,13 @@ def test_oindex():
294294
np.testing.assert_allclose(arr[:], nparr)
295295

296296

297-
@pytest.mark.parametrize("c", [None, 10])
297+
@pytest.mark.parametrize("c", [None, 3])
298298
def test_fancy_index(c):
299299
# Test 1d
300300
ndim = 1
301301
chunks = (c,) * ndim if c is not None else None
302302
dtype = np.dtype("float")
303-
d = 1 + int(1000 / dtype.itemsize) if c is None else 50
303+
d = 1 + int(1000 / dtype.itemsize) if c is None else 10
304304
shape = (d,) * ndim
305305
arr = blosc2.linspace(0, 100, num=np.prod(shape), shape=shape, dtype=dtype, chunks=chunks)
306306
rng = np.random.default_rng()
@@ -319,7 +319,7 @@ def test_fancy_index(c):
319319
chunks = (c,) * ndim if c is not None else None
320320
arr = blosc2.linspace(0, 100, num=np.prod(shape), shape=shape, dtype=dtype, chunks=chunks)
321321
rng = np.random.default_rng()
322-
idx = rng.integers(low=-d, high=d, size=(100,)) # mix of +ve and -ve indices
322+
idx = rng.integers(low=-d, high=d, size=(30,)) # mix of +ve and -ve indices
323323

324324
row = idx
325325
col = rng.permutation(idx)

0 commit comments

Comments
 (0)