Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: dask compute pytest fixture #5704

Open
rcomer opened this issue Jan 18, 2024 · 0 comments
Open

TST: dask compute pytest fixture #5704

rcomer opened this issue Jan 18, 2024 · 0 comments

Comments

@rcomer
Copy link
Member

rcomer commented Jan 18, 2024

📰 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant