-
Notifications
You must be signed in to change notification settings - Fork 296
Closed
Labels
Description
📰 Custom Issue
#5638 added a pytest fixture to mock-wrap dask's compute
function:
iris/lib/iris/tests/unit/analysis/stats/test_pearsonr.py
Lines 44 to 55 in fe46e05
@pytest.fixture | |
def mocked_compute(self, monkeypatch): | |
m_compute = mock.Mock(wraps=dask.base.compute) | |
# The three dask compute functions are all the same function but monkeypatch | |
# does not automatically know that. | |
# https://stackoverflow.com/questions/77820437 | |
monkeypatch.setattr(dask.base, dask.base.compute.__name__, m_compute) | |
monkeypatch.setattr(dask, dask.compute.__name__, m_compute) | |
monkeypatch.setattr(dask.array, dask.array.compute.__name__, m_compute) | |
return m_compute |
If this fixture were moved to a conftest.py
, it could also be used in test__arith__dask_array.py and test_broadcast_to_shape.py, where a more specific implementation is currently used.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
🌳 Backlog