|
1 | 1 | import py, os, sys |
2 | | -import cppyy |
3 | 2 | from pytest import mark, raises |
4 | | -from .support import setup_make, IS_CLANG_REPL, IS_MAC_X86, IS_MAC_ARM |
| 3 | +from .support import setup_make, IS_CLANG_REPL, IS_MAC_X86 |
5 | 4 |
|
6 | 5 | inc_paths = [os.path.join(os.path.sep, 'usr', 'include'), |
7 | 6 | os.path.join(os.path.sep, 'usr', 'local', 'include')] |
8 | 7 |
|
9 | | -noeigen = not cppyy.gbl.Cpp.Evaluate(""" |
10 | | - #if __has_include("eigen3/Eigen/Dense") |
11 | | - true |
12 | | - #else |
13 | | - false |
14 | | - #endif |
15 | | -""") |
| 8 | +eigen_path = None |
| 9 | +for p in inc_paths: |
| 10 | + p = os.path.join(p, 'eigen3') |
| 11 | + if os.path.exists(p): |
| 12 | + eigen_path = p |
16 | 13 |
|
17 | | -@mark.skipif(noeigen == True, reason="Eigen not found") |
| 14 | + |
| 15 | +@mark.skipif(eigen_path is None, reason="Eigen not found") |
18 | 16 | class TestEIGEN: |
19 | 17 | def setup_class(cls): |
20 | 18 | import cppyy, warnings |
21 | 19 |
|
| 20 | + cppyy.add_include_path(eigen_path) |
22 | 21 | with warnings.catch_warnings(): |
23 | | - cppyy.include('eigen3/Eigen/Dense') |
| 22 | + warnings.simplefilter('ignore') |
| 23 | + cppyy.include('Eigen/Dense') |
24 | 24 |
|
25 | 25 | @mark.xfail |
26 | 26 | def test01_simple_matrix_and_vector(self): |
@@ -148,16 +148,17 @@ def test04_resizing_through_assignment(self): |
148 | 148 | assert a.size() == 9 |
149 | 149 |
|
150 | 150 |
|
151 | | -@mark.skipif(noeigen == True, reason="Eigen not found") |
152 | | -class TestEIGEN_REGRESSION: |
| 151 | +@mark.skipif(eigen_path is None, reason="Eigen not found") |
| 152 | +class TestEIGEN_REGRESSIOn: |
153 | 153 | def setup_class(cls): |
154 | 154 | import cppyy, warnings |
155 | 155 |
|
| 156 | + cppyy.add_include_path(eigen_path) |
156 | 157 | with warnings.catch_warnings(): |
157 | 158 | warnings.simplefilter('ignore') |
158 | | - cppyy.include('eigen3/Eigen/Dense') |
| 159 | + cppyy.include('Eigen/Dense') |
159 | 160 |
|
160 | | - @mark.xfail(condition=((IS_MAC_ARM) or (IS_MAC_X86 and not IS_CLANG_REPL)), reason="Fails on OS X arm and osx 86 for cling") |
| 161 | + @mark.xfail(condition=IS_MAC_X86 and (not IS_CLANG_REPL), reason="Errors out on OS X Cling") |
161 | 162 | def test01_use_of_Map(self): |
162 | 163 | """Use of Map (used to crash)""" |
163 | 164 |
|
|
0 commit comments