diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 69baa3ccd6f34f..553d3e7d568a17 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -241,6 +241,49 @@ jobs: group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-32bit cancel-in-progress: true + Linux-Musl: + runs-on: ubuntu-22.04 + container: + image: quay.io/pypa/musllinux_1_1_x86_64 + steps: + - name: Checkout pandas Repo + # actions/checkout does not work since it requires node + run: | + git config --global --add safe.directory $PWD + + if [ $GITHUB_EVENT_NAME != pull_request ]; then + git clone --recursive --branch=$GITHUB_REF_NAME https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE + git reset --hard $GITHUB_SHA + else + git clone --recursive https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE + git fetch origin $GITHUB_REF:my_ref_name + git checkout $GITHUB_BASE_REF + git -c user.email="you@example.com" merge --no-commit my_ref_name + fi + - name: Configure System Packages + run: | + apk update + apk add musl-locales + - name: Build environment + run: | + /opt/python/cp39-cp39/bin/python -m venv ~/virtualenvs/pandas-dev + . ~/virtualenvs/pandas-dev/bin/activate + python -m pip install --no-cache-dir --no-deps -U pip wheel setuptools + python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.0.0 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1 + python setup.py build_ext -q -j$(nproc) + python -m pip install --no-cache-dir --no-build-isolation --no-use-pep517 -e . + python -m pip list --no-cache-dir + + - name: Run Tests + run: | + . ~/virtualenvs/pandas-dev/bin/activate + export PANDAS_CI=1 + python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml + concurrency: + # https://github.community/t/concurrecy-not-work-for-push/183068/7 + group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-musl + cancel-in-progress: true + python-dev: # This job may or may not run depending on the state of the next # unreleased Python version. DO NOT DELETE IT. diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index 3d7589bf67ee2a..00957c45a7fbeb 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -16,6 +16,7 @@ from pandas.compat._constants import ( IS64, + ISMUSL, PY310, PY311, PYPY, @@ -160,6 +161,7 @@ def get_lzma_file() -> type[pandas.compat.compressors.LZMAFile]: "pa_version_under9p0", "pa_version_under11p0", "IS64", + "ISMUSL", "PY310", "PY311", "PYPY", diff --git a/pandas/compat/_constants.py b/pandas/compat/_constants.py index 1d522a5b4cd09f..1d7fe23b3d2ea9 100644 --- a/pandas/compat/_constants.py +++ b/pandas/compat/_constants.py @@ -9,16 +9,19 @@ import platform import sys +import sysconfig IS64 = sys.maxsize > 2**32 PY310 = sys.version_info >= (3, 10) PY311 = sys.version_info >= (3, 11) PYPY = platform.python_implementation() == "PyPy" +ISMUSL = "musl" in (sysconfig.get_config_var("HOST_GNU_TYPE") or "") __all__ = [ "IS64", + "ISMUSL", "PY310", "PY311", "PYPY", diff --git a/pandas/tests/config/test_localization.py b/pandas/tests/config/test_localization.py index 6474177261b919..3907f557d10755 100644 --- a/pandas/tests/config/test_localization.py +++ b/pandas/tests/config/test_localization.py @@ -10,6 +10,8 @@ set_locale, ) +from pandas.compat import ISMUSL + import pandas as pd _all_locales = get_locales() @@ -46,7 +48,19 @@ def test_can_set_locale_valid_set(lc_var): assert before_locale == after_locale -@pytest.mark.parametrize("lc_var", (locale.LC_ALL, locale.LC_CTYPE, locale.LC_TIME)) +@pytest.mark.parametrize( + "lc_var", + ( + locale.LC_ALL, + locale.LC_CTYPE, + pytest.param( + locale.LC_TIME, + marks=pytest.mark.skipif( + ISMUSL, reason="MUSL allows setting invalid LC_TIME." + ), + ), + ), +) def test_can_set_locale_invalid_set(lc_var): # Cannot set an invalid locale. before_locale = _get_current_locale(lc_var) diff --git a/pandas/tests/tslibs/test_parsing.py b/pandas/tests/tslibs/test_parsing.py index 6500afdf87beb4..587527c2058d7b 100644 --- a/pandas/tests/tslibs/test_parsing.py +++ b/pandas/tests/tslibs/test_parsing.py @@ -14,12 +14,19 @@ strptime, ) from pandas._libs.tslibs.parsing import parse_datetime_string_with_reso +from pandas.compat import ( + ISMUSL, + is_platform_windows, +) import pandas.util._test_decorators as td import pandas._testing as tm -@td.skip_if_windows +@pytest.mark.skipif( + is_platform_windows() or ISMUSL, + reason="TZ setting incorrect on Windows and MUSL Linux", +) def test_parsing_tzlocal_deprecated(): # GH#50791 msg = "Pass the 'tz' keyword or call tz_localize after construction instead"