File tree Expand file tree Collapse file tree 3 files changed +4
-33
lines changed
Expand file tree Collapse file tree 3 files changed +4
-33
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ Other Enhancements
8282- :meth: `DataFrame.query ` and :meth: `DataFrame.eval ` now supports quoting column names with backticks to refer to names with spaces (:issue: `6508 `)
8383- :func: `merge_asof ` now gives a more clear error message when merge keys are categoricals that are not equal (:issue: `26136 `)
8484- :meth: `pandas.core.window.Rolling ` supports exponential (or Poisson) window type (:issue: `21303 `)
85- - Error message for missing required imports now includes the original ImportError's text ( :issue: ` 23868 `)
85+ -
8686
8787.. _whatsnew_0250.api_breaking :
8888
Original file line number Diff line number Diff line change 1010 try :
1111 __import__ (dependency )
1212 except ImportError as e :
13- missing_dependencies .append (( dependency , e ) )
13+ missing_dependencies .append (dependency )
1414
1515if missing_dependencies :
16- msg = "Unable to import required dependencies:"
17- for dependency , e in missing_dependencies :
18- msg += "\n {0}: {1}" .format (dependency , str (e ))
19- raise ImportError (msg )
16+ raise ImportError (
17+ "Missing required dependencies {0}" .format (missing_dependencies ))
2018del hard_dependencies , dependency , missing_dependencies
2119
2220# numpy compat
Original file line number Diff line number Diff line change 11from datetime import datetime , timedelta
2- from importlib import reload
32from io import StringIO
43import re
54import sys
6- from unittest .mock import patch
75
86import numpy as np
97import pytest
@@ -1343,28 +1341,3 @@ def test_to_numpy_dtype(as_series):
13431341 expected = np .array (['2000-01-01T05' , '2001-01-01T05' ],
13441342 dtype = 'M8[ns]' )
13451343 tm .assert_numpy_array_equal (result , expected )
1346-
1347-
1348- @patch ("builtins.__import__" )
1349- def test_missing_required_dependency (mock_import ):
1350- def mock_import_fail (name , * args , ** kwargs ):
1351- if name == "numpy" :
1352- raise ImportError ("cannot import name numpy" )
1353- elif name == "pytz" :
1354- raise ImportError ("cannot import name some_dependency" )
1355- elif name == "dateutil" :
1356- raise ImportError ("cannot import name some_other_dependency" )
1357- else :
1358- return __import__ (name , * args , ** kwargs )
1359-
1360- mock_import .side_effect = mock_import_fail
1361-
1362- expected_msg = (
1363- "Unable to import required dependencies:"
1364- "\n numpy: cannot import name numpy"
1365- "\n pytz: cannot import name some_dependency"
1366- "\n dateutil: cannot import name some_other_dependency"
1367- )
1368-
1369- with pytest .raises (ImportError , match = expected_msg ):
1370- reload (pd )
You can’t perform that action at this time.
0 commit comments