mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 22:52:01 +00:00
Merge pull request #274 from jagerman/report-skipped-tests
Skip eigen test when eigen header available but NumPy not
This commit is contained in:
commit
52269e91aa
@ -11,7 +11,11 @@ from example import sparse_r, sparse_c
|
|||||||
from example import sparse_passthrough_r, sparse_passthrough_c
|
from example import sparse_passthrough_r, sparse_passthrough_c
|
||||||
from example import double_row, double_col
|
from example import double_row, double_col
|
||||||
from example import double_mat_cm, double_mat_rm
|
from example import double_mat_cm, double_mat_rm
|
||||||
import numpy as np
|
try:
|
||||||
|
import numpy as np
|
||||||
|
except ImportError:
|
||||||
|
# NumPy missing: skip test
|
||||||
|
exit(99)
|
||||||
|
|
||||||
ref = np.array(
|
ref = np.array(
|
||||||
[[0, 3, 0, 0, 0, 11],
|
[[0, 3, 0, 0, 0, 11],
|
||||||
|
@ -7,8 +7,8 @@ import example
|
|||||||
try:
|
try:
|
||||||
import numpy as np
|
import numpy as np
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print('NumPy missing')
|
# NumPy missing: skip test
|
||||||
exit(0)
|
exit(99)
|
||||||
|
|
||||||
from example import vectorized_func
|
from example import vectorized_func
|
||||||
from example import vectorized_func2
|
from example import vectorized_func2
|
||||||
|
@ -8,8 +8,8 @@ from example import Matrix
|
|||||||
try:
|
try:
|
||||||
import numpy as np
|
import numpy as np
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print('NumPy missing')
|
# NumPy missing: skip test
|
||||||
exit(0)
|
exit(99)
|
||||||
|
|
||||||
m = Matrix(5, 5)
|
m = Matrix(5, 5)
|
||||||
|
|
||||||
|
@ -52,16 +52,20 @@ if len(sys.argv) == 3 and sys.argv[1] == '--relaxed':
|
|||||||
relaxed = True
|
relaxed = True
|
||||||
|
|
||||||
name = sys.argv[1]
|
name = sys.argv[1]
|
||||||
output_bytes = subprocess.check_output([sys.executable, name + ".py"],
|
try:
|
||||||
|
output_bytes = subprocess.check_output([sys.executable, name + ".py"],
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
if e.returncode == 99:
|
||||||
|
print('Test "%s" could not be run.' % name)
|
||||||
|
exit(0)
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
output = sanitize(output_bytes.decode('utf-8'))
|
output = sanitize(output_bytes.decode('utf-8'))
|
||||||
reference = sanitize(open(name + '.ref', 'r').read())
|
reference = sanitize(open(name + '.ref', 'r').read())
|
||||||
|
|
||||||
if 'NumPy missing' in output:
|
if output == reference:
|
||||||
print('Test "%s" could not be run.' % name)
|
|
||||||
exit(0)
|
|
||||||
elif output == reference:
|
|
||||||
print('Test "%s" succeeded.' % name)
|
print('Test "%s" succeeded.' % name)
|
||||||
exit(0)
|
exit(0)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user