From e119515fbb4b58ffaa3239bac5450d542a60b297 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Sat, 15 Aug 2026 18:32:14 -0400 Subject: [PATCH] python3Packages.pyarrow: use pure tzdata in tests test_orc.py tests may fail on darwin because they try to read from /usr/share/zoneinfo which may not work in darwin sandbox. This was reported multiple times, see: https://github.com/NixOS/nixpkgs/pull/477944 https://github.com/NixOS/nixpkgs/pull/485004 https://github.com/NixOS/nixpkgs/issues/483241 I also hit it myself in my personal flake CI. This patch switches the test to use pure tzdata to avoid the sandbox issue for darwin and re-enables one of previously skipped test_orc.py cases (for both platforms). Fixes #483241 --- pkgs/development/python-modules/pyarrow/default.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/pyarrow/default.nix b/pkgs/development/python-modules/pyarrow/default.nix index f21dac9e39cc..d911cff61143 100644 --- a/pkgs/development/python-modules/pyarrow/default.nix +++ b/pkgs/development/python-modules/pyarrow/default.nix @@ -21,6 +21,7 @@ scikit-build-core, setuptools, setuptools-scm, + tzdata, }: let @@ -121,8 +122,6 @@ buildPythonPackage rec { "pyarrow/tests/test_csv.py::TestThreadedCSVTableRead::test_cancellation" # expects arrow-cpp headers to be bundled. "pyarrow/tests/test_cpp_internals.py::test_pyarrow_include" - # Searches for TZDATA in /usr. - "pyarrow/tests/test_orc.py::test_example_using_json" # AssertionError: assert 'Europe/Monaco' == 'Europe/Paris' "pyarrow/tests/test_types.py::test_dateutil_tzinfo_to_string" # These fail with xxx_fixture not found. @@ -168,6 +167,13 @@ buildPythonPackage rec { disabledTests = [ "GcsFileSystem" ]; preCheck = '' + # Prepare r/w zoneinfo that test_orc can then copy and modify. + export TZDIR="$TMPDIR/zoneinfo" + cp -R "${tzdata}/${python.sitePackages}/tzdata/zoneinfo" "$TZDIR" + chmod -R u+w "$TZDIR" + substituteInPlace pyarrow/tests/test_orc.py \ + --replace-fail "Path('/usr/share/zoneinfo')" "Path('$TZDIR')" + export PARQUET_TEST_DATA="${arrow-cpp.env.PARQUET_TEST_DATA}" shopt -s extglob rm -r pyarrow/!(conftest.py|tests)