Skip to content

Commit cd16368

Browse files
committed
TST: Fix bz2 non-import test
1 parent 3ac3ced commit cd16368

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pandas/tests/test_common.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,11 @@ def test_str_size():
250250
def test_bz2_missing_import():
251251
# Check whether bz2 missing import is handled correctly (issue #53857)
252252
code = (
253+
"import sys\n"
254+
"assert 'bz2' in sys.modules\n"
255+
"sys.modules['bz2'] = None\n"
253256
"import pytest\n"
254-
"sys.modules.pop('bz2', None)\n"
255-
"import pandas\n"
256-
"assert 'bz2' not in sys.modules\n"
257+
"import pandas as pd\n"
257258
"from pandas.compat import get_bz2_file\n"
258259
"msg = 'bz2 module not available.'\n"
259260
"with pytest.raises(RuntimeError, match=msg):\n"

0 commit comments

Comments
 (0)