Skip to content

Commit ef5f10d

Browse files
authored
Merge pull request numpy#26325 from thalassemia/editable-skip
TST: Skip Cython test for editable install
2 parents 6f6be04 + 208b343 commit ef5f10d

File tree

10 files changed

+63
-9
lines changed

10 files changed

+63
-9
lines changed

numpy/_core/tests/test_array_interface.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import pytest
33
import numpy as np
4-
from numpy.testing import extbuild, IS_WASM
4+
from numpy.testing import extbuild, IS_WASM, IS_EDITABLE
55

66

77
@pytest.fixture
@@ -14,6 +14,8 @@ def get_module(tmp_path):
1414
pytest.skip('link fails on cygwin')
1515
if IS_WASM:
1616
pytest.skip("Can't build module inside Wasm")
17+
if IS_EDITABLE:
18+
pytest.skip("Can't build module for editable install")
1719

1820
prologue = '''
1921
#include <Python.h>

numpy/_core/tests/test_cython.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pytest
88

99
import numpy as np
10-
from numpy.testing import assert_array_equal, IS_WASM
10+
from numpy.testing import assert_array_equal, IS_WASM, IS_EDITABLE
1111

1212
# This import is copied from random.tests.test_extending
1313
try:
@@ -27,6 +27,13 @@
2727
pytestmark = pytest.mark.skipif(cython is None, reason="requires cython")
2828

2929

30+
if IS_EDITABLE:
31+
pytest.skip(
32+
"Editable install doesn't support tests with a compile step",
33+
allow_module_level=True
34+
)
35+
36+
3037
@pytest.fixture(scope='module')
3138
def install_temp(tmpdir_factory):
3239
# Based in part on test_cython from random.tests.test_extending

numpy/_core/tests/test_limited_api.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sysconfig
66
import pytest
77

8-
from numpy.testing import IS_WASM, IS_PYPY, NOGIL_BUILD
8+
from numpy.testing import IS_WASM, IS_PYPY, NOGIL_BUILD, IS_EDITABLE
99

1010
# This import is copied from random.tests.test_extending
1111
try:
@@ -25,6 +25,13 @@
2525
pytestmark = pytest.mark.skipif(cython is None, reason="requires cython")
2626

2727

28+
if IS_EDITABLE:
29+
pytest.skip(
30+
"Editable install doesn't support tests with a compile step",
31+
allow_module_level=True
32+
)
33+
34+
2835
@pytest.fixture(scope='module')
2936
def install_temp(tmpdir_factory):
3037
# Based in part on test_cython from random.tests.test_extending

numpy/_core/tests/test_mem_policy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pytest
99

1010
import numpy as np
11-
from numpy.testing import extbuild, assert_warns, IS_WASM
11+
from numpy.testing import extbuild, assert_warns, IS_WASM, IS_EDITABLE
1212
from numpy._core.multiarray import get_handler_name
1313

1414

@@ -28,6 +28,9 @@ def get_module(tmp_path):
2828
pytest.skip('link fails on cygwin')
2929
if IS_WASM:
3030
pytest.skip("Can't build module inside Wasm")
31+
if IS_EDITABLE:
32+
pytest.skip("Can't build module for editable install")
33+
3134
functions = [
3235
("get_default_policy", "METH_NOARGS", """
3336
Py_INCREF(PyDataMem_DefaultHandler);

numpy/_pyinstaller/tests/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from numpy.testing import IS_WASM, IS_EDITABLE
2+
import pytest
3+
4+
5+
if IS_WASM:
6+
pytest.skip(
7+
"WASM/Pyodide does not use or support Fortran",
8+
allow_module_level=True
9+
)
10+
11+
12+
if IS_EDITABLE:
13+
pytest.skip(
14+
"Editable install doesn't support tests with a compile step",
15+
allow_module_level=True
16+
)

numpy/distutils/tests/test_misc_util.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
from os.path import join, sep, dirname
22

3+
import pytest
4+
35
from numpy.distutils.misc_util import (
46
appendpath, minrelpath, gpaths, get_shared_lib_extension, get_info
57
)
68
from numpy.testing import (
7-
assert_, assert_equal
9+
assert_, assert_equal, IS_EDITABLE
810
)
911

1012
ajoin = lambda *paths: join(*((sep,)+paths))
@@ -73,6 +75,10 @@ def test_get_shared_lib_extension(self):
7375
assert_(get_shared_lib_extension(is_python_ext=True))
7476

7577

78+
@pytest.mark.skipif(
79+
IS_EDITABLE,
80+
reason="`get_info` .ini lookup method incompatible with editable install"
81+
)
7682
def test_installed_npymath_ini():
7783
# Regression test for gh-7707. If npymath.ini wasn't installed, then this
7884
# will give an error.

numpy/f2py/tests/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
from numpy.testing import IS_WASM
1+
from numpy.testing import IS_WASM, IS_EDITABLE
22
import pytest
33

44
if IS_WASM:
55
pytest.skip(
66
"WASM/Pyodide does not use or support Fortran",
77
allow_module_level=True
88
)
9+
10+
11+
if IS_EDITABLE:
12+
pytest.skip(
13+
"Editable install doesn't support tests with a compile step",
14+
allow_module_level=True
15+
)

numpy/random/tests/test_extending.py

Lines changed: 5 additions & 1 deletion
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:
@@ -46,6 +46,10 @@
4646
cython = None
4747

4848

49+
@pytest.mark.skipif(
50+
IS_EDITABLE,
51+
reason='Editable install cannot find .pxd headers'
52+
)
4953
@pytest.mark.skipif(
5054
sys.platform == "win32" and sys.maxsize < 2**32,
5155
reason="Failing in 32-bit Windows wheel build job, skip for now"

numpy/testing/_private/utils.py

Lines changed: 3 additions & 1 deletion
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

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[pytest]
22
addopts = -l
3-
norecursedirs = doc tools numpy/linalg/lapack_lite numpy/_core/code_generators
3+
norecursedirs = doc tools numpy/linalg/lapack_lite numpy/_core/code_generators numpy/_core/src/common/pythoncapi-compat
44
doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS ALLOW_UNICODE ALLOW_BYTES
55
junit_family=xunit2
66

0 commit comments

Comments
 (0)