Skip to content

Commit 1ffef9f

Browse files
committed
TST: add IS_EDITABLE to numpy.testing
Also make it work with meson-python 0.15.0 (that returns an empty list for `__path__`).
1 parent 418f0ee commit 1ffef9f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

numpy/random/tests/test_extending.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import warnings
1111

1212
import numpy as np
13-
from numpy.testing import IS_WASM
13+
from numpy.testing import IS_WASM, IS_EDITABLE
1414

1515

1616
try:
@@ -47,7 +47,7 @@
4747

4848

4949
@pytest.mark.skipif(
50-
'editable' in np.__path__[0],
50+
IS_EDITABLE,
5151
reason='Editable install cannot find .pxd headers'
5252
)
5353
@pytest.mark.skipif(

numpy/testing/_private/utils.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
'SkipTest', 'KnownFailureException', 'temppath', 'tempdir', 'IS_PYPY',
4040
'HAS_REFCOUNT', "IS_WASM", 'suppress_warnings', 'assert_array_compare',
4141
'assert_no_gc_cycles', 'break_cycles', 'HAS_LAPACK64', 'IS_PYSTON',
42-
'_OLD_PROMOTION', 'IS_MUSL', '_SUPPORTS_SVE', 'NOGIL_BUILD'
42+
'_OLD_PROMOTION', 'IS_MUSL', '_SUPPORTS_SVE', 'NOGIL_BUILD',
43+
'IS_EDITABLE'
4344
]
4445

4546

@@ -54,6 +55,7 @@ class KnownFailureException(Exception):
5455
IS_WASM = platform.machine() in ["wasm32", "wasm64"]
5556
IS_PYPY = sys.implementation.name == 'pypy'
5657
IS_PYSTON = hasattr(sys, "pyston_version_info")
58+
IS_EDITABLE = not bool(np.__path__) or 'editable' in np.__path__[0]
5759
HAS_REFCOUNT = getattr(sys, 'getrefcount', None) is not None and not IS_PYSTON
5860
HAS_LAPACK64 = numpy.linalg._umath_linalg._ilp64
5961

0 commit comments

Comments
 (0)