Skip to content

Commit f8e9c61

Browse files
committed
test: load pynndescent_bug_np.npz from relative path
The test `test_bad_data` will fail to load the test data `pynndescent_bug_np.npz` in case the current directory is not the repositories root directory. Load the `pynndescent_bug_np.npz` test data relative from the test file to not rely on the current directory. Signed-off-by: Benjamin Drung <[email protected]>
1 parent f7bafec commit f8e9c61

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pynndescent/tests/test_pynndescent_.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import io
33
import re
4+
import pathlib
45
import pytest
56
from contextlib import redirect_stdout
67

@@ -744,7 +745,8 @@ def test_tree_no_split(small_data, sparse_small_data, metric):
744745
"NUMBA_DISABLE_JIT" in os.environ, reason="Too expensive for disabled Numba"
745746
)
746747
def test_bad_data():
748+
test_data_dir = pathlib.Path(__file__).parent / "test_data"
747749
data = np.sqrt(
748-
np.load("pynndescent/tests/test_data/pynndescent_bug_np.npz")["arr_0"]
750+
np.load(test_data_dir / "pynndescent_bug_np.npz")["arr_0"]
749751
)
750752
index = NNDescent(data, metric="cosine")

0 commit comments

Comments
 (0)