Skip to content

Commit 208b343

Browse files
committed
TST: skip other tests that don't work under editable install
The main reason is that tests with a compile step cannot work, because headers aren't found. The distutils test could be made to work, but that isn't worth the effort since it's deprecated code.
1 parent e2665a5 commit 208b343

File tree

7 files changed

+54
-6
lines changed

7 files changed

+54
-6
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+
)

0 commit comments

Comments
 (0)