(get_module)
| 313 | |
| 314 | |
| 315 | async def async_test_context_locality(get_module): |
| 316 | orig_policy_name = np.core.multiarray.get_handler_name() |
| 317 | |
| 318 | event = asyncio.Event() |
| 319 | # the child contexts inherit the parent policy |
| 320 | concurrent_task1 = asyncio.create_task( |
| 321 | concurrent_context1(get_module, orig_policy_name, event)) |
| 322 | concurrent_task2 = asyncio.create_task( |
| 323 | concurrent_context2(get_module, orig_policy_name, event)) |
| 324 | await concurrent_task1 |
| 325 | await concurrent_task2 |
| 326 | |
| 327 | # the parent context is not affected by child policy changes |
| 328 | assert np.core.multiarray.get_handler_name() == orig_policy_name |
| 329 | |
| 330 | |
| 331 | @pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") |
no test coverage detected