Quick sanity checks for common bugs caused by environment. There are some cases e.g. with wrong BLAS ABI that cause wrong results under specific runtime conditions that are not necessarily achieved during test suite runs, and it is useful to catch those early.
()
| 784 | del PytestTester |
| 785 | |
| 786 | def _sanity_check(): |
| 787 | """ |
| 788 | Quick sanity checks for common bugs caused by environment. |
| 789 | There are some cases e.g. with wrong BLAS ABI that cause wrong |
| 790 | results under specific runtime conditions that are not necessarily |
| 791 | achieved during test suite runs, and it is useful to catch those early. |
| 792 | |
| 793 | See https://github.com/numpy/numpy/issues/8577 and other |
| 794 | similar bug reports. |
| 795 | |
| 796 | """ |
| 797 | try: |
| 798 | x = ones(2, dtype=float32) |
| 799 | if not abs(x.dot(x) - float32(2.0)) < 1e-5: |
| 800 | raise AssertionError |
| 801 | except AssertionError: |
| 802 | msg = ("The current Numpy installation ({!r}) fails to " |
| 803 | "pass simple sanity checks. This can be caused for example " |
| 804 | "by incorrect BLAS library being linked in, or by mixing " |
| 805 | "package managers (pip, conda, apt, ...). Search closed " |
| 806 | "numpy issues for similar problems.") |
| 807 | raise RuntimeError(msg.format(__file__)) from None |
| 808 | |
| 809 | _sanity_check() |
| 810 | del _sanity_check |
no test coverage detected
searching dependent graphs…