Inject C++ tests as Python functions into namespace `ns` (a dict).
(ns)
| 24 | |
| 25 | |
| 26 | def inject_cpp_tests(ns): |
| 27 | """ |
| 28 | Inject C++ tests as Python functions into namespace `ns` (a dict). |
| 29 | """ |
| 30 | for case in get_cpp_tests(): |
| 31 | |
| 32 | def wrapper(case=case): |
| 33 | case() |
| 34 | wrapper.__name__ = wrapper.__qualname__ = case.name |
| 35 | wrapper.__module__ = ns['__name__'] |
| 36 | # Add numpy or pandas marks if the test requires it |
| 37 | if 'numpy' in case.name: |
| 38 | wrapper = pytest.mark.numpy(wrapper) |
| 39 | elif 'pandas' in case.name: |
| 40 | wrapper = pytest.mark.pandas(wrapper) |
| 41 | ns[case.name] = wrapper |
| 42 | |
| 43 | |
| 44 | inject_cpp_tests(globals()) |