File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717}
1818
1919
20- def import_optional_dependency (
20+ def _import_optional_dependency (
2121 name : str ,
2222 extra : str = "" ,
2323 raise_error : bool = True ,
Original file line number Diff line number Diff line change 22
33import pytest
44
5- from .._imports import import_optional_dependency
5+ from .._imports import _import_optional_dependency
66
77
88def test_import_optional_dependency ():
99 """Test the import of optional dependencies."""
1010 # Test import of present package
11- numpy = import_optional_dependency ("numpy" )
11+ numpy = _import_optional_dependency ("numpy" )
1212 assert isinstance (numpy .__version__ , str )
1313
1414 # Test import of absent package
1515 with pytest .raises (ImportError , match = "Missing optional dependency" ):
16- import_optional_dependency ("non_existing_pkg" , raise_error = True )
16+ _import_optional_dependency ("non_existing_pkg" , raise_error = True )
1717
1818 # Test import of absent package without raise
19- pkg = import_optional_dependency ("non_existing_pkg" , raise_error = False )
19+ pkg = _import_optional_dependency ("non_existing_pkg" , raise_error = False )
2020 assert pkg is None
2121
2222 # Test extra
2323 with pytest .raises (ImportError , match = "blabla" ):
24- import_optional_dependency ("non_existing_pkg" , extra = "blabla" )
24+ _import_optional_dependency ("non_existing_pkg" , extra = "blabla" )
You can’t perform that action at this time.
0 commit comments