arrow-py / arrow

🏹 Better dates & times for Python
https://arrow.readthedocs.io
Apache License 2.0
8.71k stars 673 forks source link

test_shift_kiritimati - AssertionError #949

Closed skupr-anaconda closed 3 years ago

skupr-anaconda commented 3 years ago

Issue Description

+ pytest --cov arrow -k 'not parse_tz_name_zzz'
============================= test session starts ==============================
platform linux -- Python 3.6.13, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
rootdir: $SRC_DIR/tests
plugins: cov-2.11.1, mock-3.5.1
collected 1682 items / 596 deselected / 1086 selected

test_api.py ....                                                         [  0%]
test_arrow.py .......................................................... [  5%]
................................F....................................... [ 12%]
..................................x.x........................            [ 17%]
test_factory.py ............................................             [ 22%]
test_formatter.py ...................................................... [ 26%]
........................................................................ [ 33%]
........................................................................ [ 40%]
........................................................................ [ 46%]
........................................................................ [ 53%]
........................................................................ [ 60%]
........................................................................ [ 66%]
........................................................................ [ 73%]
..............................................................           [ 79%]
test_locales.py ........................................................ [ 84%]
............................................                             [ 88%]
test_parser.py ......................................................... [ 93%]
.................................................................        [ 99%]
test_util.py .....                                                       [100%]

=================================== FAILURES ===================================
_____________________ TestArrowShift.test_shift_kiritimati _____________________

self = <tests.test_arrow.TestArrowShift object at 0x7f8cd72b7da0>

    @pytest.mark.skipif(
        dateutil.__version__ < "2.7.1", reason="old tz database (2018d needed)"
    )
    def test_shift_kiritimati(self):
        # corrected 2018d tz database release, will fail in earlier versions

        kiritimati = arrow.Arrow(1994, 12, 30, 12, 30, tzinfo="Pacific/Kiritimati")
>       assert kiritimati.shift(days=+1) == arrow.Arrow(
            1995, 1, 1, 12, 30, tzinfo="Pacific/Kiritimati"
        )
E       AssertionError: assert <Arrow [1994-12-31T12:30:00-10:00]> == <Arrow [1995-01-01T12:30:00-10:00]>
E        +  where <Arrow [1994-12-31T12:30:00-10:00]> = <bound method Arrow.shift of <Arrow [1994-12-30T12:30:00-10:00]>>(days=+1)
E        +    where <bound method Arrow.shift of <Arrow [1994-12-30T12:30:00-10:00]>> = <Arrow [1994-12-30T12:30:00-10:00]>.shift
E        +  and   <Arrow [1995-01-01T12:30:00-10:00]> = <class 'arrow.arrow.Arrow'>(1995, 1, 1, 12, 30, tzinfo='Pacific/Kiritimati')
E        +    where <class 'arrow.arrow.Arrow'> = arrow.Arrow

test_arrow.py:939: AssertionError

---------- coverage: platform linux, python 3.6.13-final-0 -----------
Name                                                                                                                                                                                                                                                                                                           Stmts   Miss  Cover
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$PREFIX/lib/python3.6/site-packages/arrow/__init__.py        7      0   100%
$PREFIX/lib/python3.6/site-packages/arrow/_version.py        1      0   100%
$PREFIX/lib/python3.6/site-packages/arrow/api.py            27      0   100%
$PREFIX/lib/python3.6/site-packages/arrow/arrow.py         498      4    99%
$PREFIX/lib/python3.6/site-packages/arrow/constants.py       9      0   100%
$PREFIX/lib/python3.6/site-packages/arrow/factory.py        85      0   100%
$PREFIX/lib/python3.6/site-packages/arrow/formatter.py     101      0   100%
$PREFIX/lib/python3.6/site-packages/arrow/locales.py       812      0   100%
$PREFIX/lib/python3.6/site-packages/arrow/parser.py        312      0   100%
$PREFIX/lib/python3.6/site-packages/arrow/util.py           45      0   100%
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                                                                                                                                                                                                           1897      4    99%

=========================== short test summary info ============================
FAILED test_arrow.py::TestArrowShift::test_shift_kiritimati - AssertionError:...
========== 1 failed, 1083 passed, 596 deselected, 2 xfailed in 7.17s ===========
Tests failed for arrow-1.0.3-py36h06a4308_1.tar.bz2 - moving package to /tmp/build/80754af9/broken
WARNING:conda_build.build:Tests failed for arrow-1.0.3-py36h06a4308_1.tar.bz2 - moving package to /tmp/build/80754af9/broken
WARNING conda_build.build:tests_failed(2956): Tests failed for arrow-1.0.3-py36h06a4308_1.tar.bz2 - moving package to /tmp/build/80754af9/broken
TESTS FAILED: arrow-1.0.3-py36h06a4308_1.tar.bz2

System Info

jadchaar commented 3 years ago

Hmm I am unable to reproduce this myself and it does not seem to be occurring on our Linux CI runners. Any ideas @systemcatch?

systemcatch commented 3 years ago

My first thought is that an old dateutil package (< 2.7.1) is being used somewhere and causing the test to fail. However that should be covered by the pytest mark.

@skupr-anaconda can you give us a list of installed python packages on your system and the dateutil version that is being used?

skupr-anaconda commented 3 years ago

Package Plan

environment location: /tmp/build/80754af9/arrow_1617953470930/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla

The following NEW packages will be INSTALLED:

_libgcc_mutex:      0.1-main                 defaults                                   
arrow:              1.0.3-py36h06a4308_1     file:///tmp/build/80754af9/output-artifacts
attrs:              20.3.0-pyhd3eb1b0_0      defaults                                   
ca-certificates:    2021.1.19-h06a4308_1     defaults                                   
certifi:            2020.12.5-py36h06a4308_0 defaults                                   
coverage:           5.5-py36h27cfd23_2       defaults                                   
dateparser:         1.0.0-pyhd3eb1b0_0       defaults                                   
importlib-metadata: 3.10.0-py36h06a4308_0    defaults                                   
importlib_metadata: 3.10.0-hd3eb1b0_0        defaults                                   
iniconfig:          1.1.1-pyhd3eb1b0_0       defaults                                   
ld_impl_linux-64:   2.33.1-h53a641e_7        defaults                                   
libffi:             3.3-he6710b0_2           defaults                                   
libgcc-ng:          9.1.0-hdf63c60_0         defaults                                   
libstdcxx-ng:       9.1.0-hdf63c60_0         defaults                                   
more-itertools:     8.7.0-pyhd3eb1b0_0       defaults                                   
ncurses:            6.2-he6710b0_1           defaults                                   
openssl:            1.1.1k-h27cfd23_0        defaults                                   
packaging:          20.9-pyhd3eb1b0_0        defaults                                   
pip:                21.0.1-py36h06a4308_0    defaults                                   
pluggy:             0.13.1-py36h06a4308_0    defaults                                   
py:                 1.10.0-pyhd3eb1b0_0      defaults                                   
pyparsing:          2.4.7-pyhd3eb1b0_0       defaults                                   
pytest:             6.2.3-py36h06a4308_2     defaults                                   
pytest-cov:         2.11.1-pyhd3eb1b0_0      defaults                                   
pytest-mock:        3.5.1-pyhd3eb1b0_1       defaults                                   
python:             3.6.13-hdb3f193_0        defaults                                   
python-dateutil:    2.8.1-pyhd3eb1b0_0       defaults                                   
pytz:               2021.1-pyhd3eb1b0_0      defaults                                   
readline:           8.1-h27cfd23_0           defaults                                   
regex:              2021.4.4-py36h27cfd23_0  defaults                                   
setuptools:         52.0.0-py36h06a4308_0    defaults                                   
simplejson:         3.17.2-py36h27cfd23_2    defaults                                   
six:                1.15.0-py36h06a4308_0    defaults                                   
sqlite:             3.35.4-hdfb4753_0        defaults                                   
tk:                 8.6.10-hbc83047_0        defaults                                   
toml:               0.10.2-pyhd3eb1b0_0      defaults                                   
typing_extensions:  3.7.4.3-pyha847dfd_0     defaults                                   
tzlocal:            2.1-py36_0               defaults                                   
wheel:              0.36.2-pyhd3eb1b0_0      defaults                                   
xz:                 5.2.5-h7b6447c_0         defaults                                   
zipp:               3.4.1-pyhd3eb1b0_0       defaults                                   
zlib:               1.2.11-h7b6447c_3        defaults                                   
systemcatch commented 3 years ago

Closing this for now as we cannot reproduce at our end, let us know if it needs reopening.