()
| 86 | |
| 87 | |
| 88 | def test_popen_pool_executor(): |
| 89 | import tvm_ffi |
| 90 | |
| 91 | import tvm |
| 92 | |
| 93 | pool = PopenPoolExecutor(max_workers=2, timeout=0.015) |
| 94 | value1 = pool.submit(identity_after, 1, 100) |
| 95 | value2 = pool.submit(terminate_self) |
| 96 | value3 = pool.submit(identity_after, 3, 0) |
| 97 | value4 = pool.submit(tvm_ffi.core.String, "xyz") |
| 98 | |
| 99 | with pytest.raises(TimeoutError): |
| 100 | value1.result() |
| 101 | |
| 102 | with pytest.raises(ChildProcessError): |
| 103 | value2.result() |
| 104 | |
| 105 | assert value3.result() == 3 |
| 106 | value = value4.result() |
| 107 | assert value == "xyz" |
| 108 | |
| 109 | pool = PopenPoolExecutor(max_workers=4, timeout=None) |
| 110 | values = pool.map_with_error_catching(lambda x: x, range(100)) |
| 111 | |
| 112 | for idx, val in enumerate(values): |
| 113 | assert val.value == idx |
| 114 | |
| 115 | |
| 116 | def test_popen_initializer(): |
no test coverage detected
searching dependent graphs…