ci: avoid failure to build numpy on 3.12
This commit is contained in:
parent
e75d773f0a
commit
d395fe8653
|
@ -1,21 +1,24 @@
|
||||||
import nox
|
import nox
|
||||||
import platform
|
from nox.command import CommandFailed
|
||||||
|
|
||||||
nox.options.sessions = ["test"]
|
nox.options.sessions = ["test"]
|
||||||
|
|
||||||
|
|
||||||
@nox.session
|
@nox.session
|
||||||
def test(session):
|
def test(session: nox.Session):
|
||||||
session.install("-rrequirements-dev.txt")
|
session.install("-rrequirements-dev.txt")
|
||||||
if platform.system() == "Linux" and platform.python_implementation() == "CPython":
|
try:
|
||||||
session.install("numpy>=1.16")
|
session.install("--only-binary=numpy", "numpy>=1.16")
|
||||||
|
except CommandFailed:
|
||||||
|
# No binary wheel for numpy available on this platform
|
||||||
|
pass
|
||||||
session.install("maturin")
|
session.install("maturin")
|
||||||
session.run_always("maturin", "develop")
|
session.run_always("maturin", "develop")
|
||||||
session.run("pytest", *session.posargs)
|
session.run("pytest", *session.posargs)
|
||||||
|
|
||||||
|
|
||||||
@nox.session
|
@nox.session
|
||||||
def bench(session):
|
def bench(session: nox.Session):
|
||||||
session.install("-rrequirements-dev.txt")
|
session.install("-rrequirements-dev.txt")
|
||||||
session.install(".")
|
session.install(".")
|
||||||
session.run("pytest", "--benchmark-enable", "--benchmark-only", *session.posargs)
|
session.run("pytest", "--benchmark-enable", "--benchmark-only", *session.posargs)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import pytest
|
import pytest
|
||||||
import platform
|
|
||||||
|
|
||||||
from pyo3_pytests import sequence
|
from pyo3_pytests import sequence
|
||||||
|
|
||||||
|
@ -21,21 +20,15 @@ def test_vec_from_str():
|
||||||
sequence.vec_to_vec_pystring("123")
|
sequence.vec_to_vec_pystring("123")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
|
||||||
platform.system() != "Linux" or platform.python_implementation() != "CPython",
|
|
||||||
reason="Binary NumPy wheels are not available for all platforms and Python implementations",
|
|
||||||
)
|
|
||||||
def test_vec_from_array():
|
def test_vec_from_array():
|
||||||
import numpy
|
# binary numpy wheel not available on all platforms
|
||||||
|
numpy = pytest.importorskip("numpy")
|
||||||
|
|
||||||
assert sequence.vec_to_vec_i32(numpy.array([1, 2, 3])) == [1, 2, 3]
|
assert sequence.vec_to_vec_i32(numpy.array([1, 2, 3])) == [1, 2, 3]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
|
||||||
platform.system() != "Linux" or platform.python_implementation() != "CPython",
|
|
||||||
reason="Binary NumPy wheels are not available for all platforms and Python implementations",
|
|
||||||
)
|
|
||||||
def test_rust_array_from_array():
|
def test_rust_array_from_array():
|
||||||
import numpy
|
# binary numpy wheel not available on all platforms
|
||||||
|
numpy = pytest.importorskip("numpy")
|
||||||
|
|
||||||
assert sequence.array_to_array_i32(numpy.array([1, 2, 3])) == [1, 2, 3]
|
assert sequence.array_to_array_i32(numpy.array([1, 2, 3])) == [1, 2, 3]
|
||||||
|
|
Loading…
Reference in New Issue