MCPcopy
hub / github.com/pandas-dev/pandas / test_missing_required_dependency

Function test_missing_required_dependency

pandas/tests/test_downstream.py:191–204  ·  view source on GitHub ↗
(monkeypatch, dependency)

Source from the content-addressed store, hash-verified

189
190@pytest.mark.parametrize("dependency", ["numpy", "dateutil"])
191def test_missing_required_dependency(monkeypatch, dependency):
192 # GH#61030
193 original_import = __import__
194 mock_error = ImportError(f"Mock error for {dependency}")
195
196 def mock_import(name, *args, **kwargs):
197 if name == dependency:
198 raise mock_error
199 return original_import(name, *args, **kwargs)
200
201 monkeypatch.setattr("builtins.__import__", mock_import)
202
203 with pytest.raises(ImportError, match=dependency):
204 importlib.reload(importlib.import_module("pandas"))
205
206
207def test_frame_setitem_dask_array_into_new_col(request):

Callers

nothing calls this directly

Calls 1

raisesMethod · 0.45

Tested by

no test coverage detected