Skip to content

TST: dask compute pytest fixture #5704

@rcomer

Description

@rcomer

📰 Custom Issue

#5638 added a pytest fixture to mock-wrap dask's compute function:

@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

Type

No type

Projects

Status

🌳 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions