MCPcopy Index your code
hub / github.com/pydata/xarray / test_attempt_import

Function test_attempt_import

xarray/tests/test_utils.py:394–402  ·  view source on GitHub ↗

Test optional dependency handling.

()

Source from the content-addressed store, hash-verified

392
393
394def test_attempt_import() -> None:
395 """Test optional dependency handling."""
396 np = attempt_import("numpy")
397 assert np.__name__ == "numpy"
398
399 with pytest.raises(ImportError, match="The foo package is required"):
400 attempt_import(module="foo")
401 with pytest.raises(ImportError, match="The foo package is required"):
402 attempt_import(module="foo.bar")

Callers

nothing calls this directly

Calls 1

attempt_importFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…