Test optional dependency handling.
()
| 392 | |
| 393 | |
| 394 | def 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") |
nothing calls this directly
no test coverage detected
searching dependent graphs…