Skip to content

Commit

Permalink
apacheGH-36991: [Python][Packaging] Skip tests on Win that require a …
Browse files Browse the repository at this point in the history
…tz database (apache#36996)

### Rationale for this change

Some tests require a tz database, which Windows might not provide at the expected file location. Skip them if the tz db is not found.

### What changes are included in this PR?

* Tests skipped if tz db is not found

### Are these changes tested?

Yes

### Are there any user-facing changes?

No
* Closes: apache#36991

Authored-by: Dane Pitkin <dane@voltrondata.com>
Signed-off-by: AlenkaF <frim.alenka@gmail.com>
  • Loading branch information
danepitkin authored and loicalleyne committed Nov 13, 2023
1 parent 8d9cfb4 commit 89a0d57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/pyarrow/tests/test_convert_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
import itertools
import math
import re
import sys

import hypothesis as h
import numpy as np
import pytest

from pyarrow.pandas_compat import _pandas_api # noqa
import pyarrow as pa
from pyarrow.tests import util
import pyarrow.tests.strategies as past


Expand Down Expand Up @@ -1338,6 +1340,8 @@ def test_sequence_timestamp_nanoseconds():


@pytest.mark.pandas
@pytest.mark.skipif(sys.platform == "win32" and not util.windows_has_tzdata(),
reason="Timezone database is not installed on Windows")
def test_sequence_timestamp_from_int_with_unit():
# TODO(wesm): This test might be rewritten to assert the actual behavior
# when pandas is not installed
Expand Down
2 changes: 2 additions & 0 deletions python/pyarrow/tests/test_scalars.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ def test_hashing_struct_scalar():
assert hash1 == hash2


@pytest.mark.skipif(sys.platform == "win32" and not util.windows_has_tzdata(),
reason="Timezone database is not installed on Windows")
def test_timestamp_scalar():
a = repr(pa.scalar("0000-01-01").cast(pa.timestamp("s")))
assert a == "<pyarrow.TimestampScalar: '0000-01-01T00:00:00'>"
Expand Down

0 comments on commit 89a0d57

Please sign in to comment.