Mocks the registering of an additional ChunkManagerEntrypoint. This preserves the presence of the existing DaskManager, so a test that relies on this and DaskManager both being returned from list_chunkmanagers() at once would still work. The monkeypatching changes the behavior of
(monkeypatch)
| 130 | |
| 131 | @pytest.fixture |
| 132 | def register_dummy_chunkmanager(monkeypatch): |
| 133 | """ |
| 134 | Mocks the registering of an additional ChunkManagerEntrypoint. |
| 135 | |
| 136 | This preserves the presence of the existing DaskManager, so a test that relies on this and DaskManager both being |
| 137 | returned from list_chunkmanagers() at once would still work. |
| 138 | |
| 139 | The monkeypatching changes the behavior of list_chunkmanagers when called inside xarray.namedarray.parallelcompat, |
| 140 | but not when called from this tests file. |
| 141 | """ |
| 142 | # Should include DaskManager iff dask is available to be imported |
| 143 | preregistered_chunkmanagers = list_chunkmanagers() |
| 144 | |
| 145 | monkeypatch.setattr( |
| 146 | "xarray.namedarray.parallelcompat.list_chunkmanagers", |
| 147 | lambda: {"dummy": DummyChunkManager()} | preregistered_chunkmanagers, |
| 148 | ) |
| 149 | yield |
| 150 | |
| 151 | |
| 152 | class TestGetChunkManager: |
nothing calls this directly
no test coverage detected
searching dependent graphs…