Skip to content

BUG: Fix pandas compatibility with Python installations lacking bzip2 headers #53858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 7, 2023
10 changes: 10 additions & 0 deletions pandas/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import numpy as np
import pytest

sys.modules.pop("bz2", None) # Remove 'bz2' from available modules for testing
from pandas.compat import get_bz2_file

import pandas as pd
from pandas import Series
import pandas._testing as tm
Expand All @@ -15,6 +18,13 @@
from pandas.util.version import Version


def test_bz2_nonimport():
assert "bz2" not in sys.modules
msg = "bz2 module not available."
with pytest.raises(RuntimeError, match=msg):
get_bz2_file()


def test_get_callable_name():
getname = com.get_callable_name

Expand Down