Skip to content

Commit

Permalink
TST: Fix bz2 non-import test
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Jun 27, 2023
1 parent 3ac3ced commit cd16368
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pandas/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,11 @@ def test_str_size():
def test_bz2_missing_import():
# Check whether bz2 missing import is handled correctly (issue #53857)
code = (
"import sys\n"
"assert 'bz2' in sys.modules\n"
"sys.modules['bz2'] = None\n"
"import pytest\n"
"sys.modules.pop('bz2', None)\n"
"import pandas\n"
"assert 'bz2' not in sys.modules\n"
"import pandas as pd\n"
"from pandas.compat import get_bz2_file\n"
"msg = 'bz2 module not available.'\n"
"with pytest.raises(RuntimeError, match=msg):\n"
Expand Down

0 comments on commit cd16368

Please sign in to comment.