Assert that expected OpenBLAS version is actually available via NumPy. Requires threadpoolctl
(expected_version=None)
| 324 | |
| 325 | |
| 326 | def test_version(expected_version=None): |
| 327 | """ |
| 328 | Assert that expected OpenBLAS version is |
| 329 | actually available via NumPy. Requires threadpoolctl |
| 330 | """ |
| 331 | import numpy |
| 332 | import threadpoolctl |
| 333 | |
| 334 | data = threadpoolctl.threadpool_info() |
| 335 | if len(data) != 1: |
| 336 | if platform.python_implementation() == 'PyPy': |
| 337 | print(f"Not using OpenBLAS for PyPy in Azure CI, so skip this") |
| 338 | return |
| 339 | raise ValueError(f"expected single threadpool_info result, got {data}") |
| 340 | if not expected_version: |
| 341 | expected_version = OPENBLAS_V |
| 342 | if data[0]['version'] != expected_version: |
| 343 | raise ValueError( |
| 344 | f"expected OpenBLAS version {expected_version}, got {data}" |
| 345 | ) |
| 346 | print("OK") |
| 347 | |
| 348 | if __name__ == '__main__': |
| 349 | import argparse |
no test coverage detected