(local_cfg, monkeypatch)
| 153 | |
| 154 | @pytest.mark.execution_timeout(30) |
| 155 | def test_parallel_map_internal_client(local_cfg, monkeypatch): |
| 156 | # Test the branch where client=None and get_client() is internally used |
| 157 | class _Ctx: |
| 158 | def __init__(self, client): |
| 159 | self.client = client |
| 160 | |
| 161 | def __enter__(self): |
| 162 | return self.client |
| 163 | |
| 164 | def __exit__(self, exc_type, exc, tb): |
| 165 | self.client.close() |
| 166 | |
| 167 | cli = build_client(local_cfg) |
| 168 | monkeypatch.setattr( |
| 169 | "espnet3.parallel.parallel.get_client", lambda *a, **k: _Ctx(cli) |
| 170 | ) |
| 171 | res = parallel_map(lambda x: x * 2, [1, 2, 3]) |
| 172 | assert res == [2, 4, 6] |
| 173 | |
| 174 | |
| 175 | # ------------------------------------------------------------ |
nothing calls this directly
no test coverage detected
searching dependent graphs…