-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
GH-35040: [Python] Skip test_cast_timestamp_to_string on Windows because it requires tz database #35735
GH-35040: [Python] Skip test_cast_timestamp_to_string on Windows because it requires tz database #35735
Conversation
…s because it requires tz database
@github-actions crossbow submit -g wheel |
Revision: 64c0d83 Submitted crossbow builds: ursacomputing/crossbow @ actions-fe7da097ff |
@rok does this look right? We are able to somehow use a timezone database on Windows, IIRC? |
Yeah, the better fix would actually be to detect if the database is available, and only skip if not found on windows. Because this patch skips the tests altogether, even when it can actually work (eg on appveyor the tests pass because we download the tzdata during appveyor setup). But just to note: we currently do this plain skip for other tests requiring the database as well, so that is an existing issue with our test setup. I assume checking if the path |
Thanks for fixing! There are other tests in this file that also use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For completeness - I believe db download for windows was added by @wjones127 in #12536.
That was just for C++ and R. I don't think we figured out how to do it for Python, since we need the text form of the IANA database while Python's timezone packages provide the binary form. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have 3 tests being skipped on Windows for the same reason.
https://github.com/apache/arrow/blob/main/python/pyarrow/tests/test_compute.py#L1851
https://github.com/apache/arrow/blob/main/python/pyarrow/tests/test_compute.py#L2042
https://github.com/apache/arrow/blob/main/python/pyarrow/tests/test_compute.py#L2042
I am +1 to merge
if sys.platform != "win32": | ||
# Locale-dependent formats don't match on Windows | ||
formats.extend(["%c", "%x", "%X"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error on Appveyor we got was:
@pytest.mark.skipif(sys.platform == "win32" and not util.windows_has_tzdata(),
reason="Timezone database is not installed on Windows")
def test_strftime():
times = ["2018-03-10 09:00", "2038-01-31 12:23", None]
timezones = ["CET", "UTC", "Europe/Ljubljana"]
formats = ["%a", "%A", "%w", "%d", "%b", "%B", "%m", "%y", "%Y", "%H",
"%I", "%p", "%M", "%z", "%Z", "%j", "%U", "%W", "%c", "%x",
"%X", "%%", "%G", "%V", "%u"]
for timezone in timezones:
ts = pd.to_datetime(times).tz_localize(timezone)
for unit in ["s", "ms", "us", "ns"]:
tsa = pa.array(ts, type=pa.timestamp(unit, timezone))
for fmt in formats:
options = pc.StrftimeOptions(fmt)
result = pc.strftime(tsa, options=options)
expected = pa.array(ts.strftime(fmt))
> assert result.equals(expected)
E assert False
E + where False = <built-in method equals of pyarrow.lib.StringArray object at 0x0000023767338600>(<pyarrow.lib.StringArray object at 0x0000023767338830>\n[\n "Sat Mar 10 09:00:00 2018",\n "Sun Jan 31 12:23:00 2038",\n null\n])
E + where <built-in method equals of pyarrow.lib.StringArray object at 0x0000023767338600> = <pyarrow.lib.StringArray object at 0x0000023767338600>\n[\n "03/10/18 09:00:00",\n "01/31/38 12:23:00",\n null\n].equals
pyarrow\tests\test_compute.py:1872: AssertionError
So it seems that we create a string like "Sat Mar 10 09:00:00 2018", but the python version we compare with gives "03/10/18 09:00:00". According to docs for %c
, the former (our result) is actually correct.
But since we are checking matching results in Python in this test, just skipping the ones where those don't match.
I updated the PR to actually check if the tzdata database was present, and only skip the tests if not. Because we do actually already download the tzdb on Appveyor (not on the nightly wheel builds, so therefore the tests were failing there). |
@github-actions crossbow submit -g wheel |
This comment was marked as outdated.
This comment was marked as outdated.
@github-actions crossbow submit -g wheel |
Revision: 9720e36 Submitted crossbow builds: ursacomputing/crossbow @ actions-5e510fd809 |
Benchmark runs are scheduled for baseline = 4ec231b and contender = c78ef0f. c78ef0f is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Rationale for this change
Fix up of #35395, skipping one of the tests added in that PR on Windows, because the test requires access to a tz database.