()
| 2071 | @pytest.mark.skipif(IS_WASM, reason="Cannot start subprocess") |
| 2072 | @pytest.mark.slow |
| 2073 | def test_sdot_bug_8577(): |
| 2074 | # Regression test that loading certain other libraries does not |
| 2075 | # result to wrong results in float32 linear algebra. |
| 2076 | # |
| 2077 | # There's a bug gh-8577 on OSX that can trigger this, and perhaps |
| 2078 | # there are also other situations in which it occurs. |
| 2079 | # |
| 2080 | # Do the check in a separate process. |
| 2081 | |
| 2082 | bad_libs = ['PyQt5.QtWidgets', 'IPython'] |
| 2083 | |
| 2084 | template = textwrap.dedent(""" |
| 2085 | import sys |
| 2086 | {before} |
| 2087 | try: |
| 2088 | import {bad_lib} |
| 2089 | except ImportError: |
| 2090 | sys.exit(0) |
| 2091 | {after} |
| 2092 | x = np.ones(2, dtype=np.float32) |
| 2093 | sys.exit(0 if np.allclose(x.dot(x), 2.0) else 1) |
| 2094 | """) |
| 2095 | |
| 2096 | for bad_lib in bad_libs: |
| 2097 | code = template.format(before="import numpy as np", after="", |
| 2098 | bad_lib=bad_lib) |
| 2099 | run_subprocess([sys.executable, "-c", code]) |
| 2100 | |
| 2101 | # Swapped import order |
| 2102 | code = template.format(after="import numpy as np", before="", |
| 2103 | bad_lib=bad_lib) |
| 2104 | run_subprocess([sys.executable, "-c", code]) |
| 2105 | |
| 2106 | |
| 2107 | class TestMultiDot: |
nothing calls this directly
no test coverage detected
searching dependent graphs…