-  
-   Notifications  You must be signed in to change notification settings 
- Fork 19.2k
Description
Code Sample, a copy-pastable example if possible
pandas.test(['-k', 'test_dti_tz_localize_roundtrip']) pandas/tests/indexes/datetimes/test_timezones.py ...........................F............ [100%] ============================================================================= FAILURES ============================================================================== _________________________________________ TestDatetimeIndexTimezones.test_dti_tz_localize_roundtrip[tz_aware_fixture6-idx3] _________________________________________ self = <pandas.tests.indexes.datetimes.test_timezones.TestDatetimeIndexTimezones object at 0x1c27c88f28>, tz_aware_fixture = tzlocal() idx = DatetimeIndex(['2014-08-01 00:00:00', '2014-08-01 00:01:00', '2014-08-01 00:02:00', '2014-08-01 00:03:0... '2014-10-30 23:59:00', '2014-10-31 00:00:00'], dtype='datetime64[ns]', length=131041, freq='T') @pytest.mark.parametrize('idx', [ date_range(start='2014-01-01', end='2014-12-31', freq='M'), date_range(start='2014-01-01', end='2014-12-31', freq='D'), date_range(start='2014-01-01', end='2014-03-01', freq='H'), date_range(start='2014-08-01', end='2014-10-31', freq='T') ]) def test_dti_tz_localize_roundtrip(self, tz_aware_fixture, idx): tz = tz_aware_fixture localized = idx.tz_localize(tz) expected = date_range(start=idx[0], end=idx[-1], freq=idx.freq, tz=tz) > tm.assert_index_equal(localized, expected) E AssertionError: Index are different E E Index length are different E [left]: 131041, DatetimeIndex(['2014-08-01 00:00:00+01:00', '2014-08-01 00:01:00+01:00', E '2014-08-01 00:02:00+01:00', '2014-08-01 00:03:00+01:00', E '2014-08-01 00:04:00+01:00', '2014-08-01 00:05:00+01:00', E '2014-08-01 00:06:00+01:00', '2014-08-01 00:07:00+01:00', E '2014-08-01 00:08:00+01:00', '2014-08-01 00:09:00+01:00', E ... E '2014-10-30 23:51:00+00:00', '2014-10-30 23:52:00+00:00', E '2014-10-30 23:53:00+00:00', '2014-10-30 23:54:00+00:00', E '2014-10-30 23:55:00+00:00', '2014-10-30 23:56:00+00:00', E '2014-10-30 23:57:00+00:00', '2014-10-30 23:58:00+00:00', E '2014-10-30 23:59:00+00:00', '2014-10-31 00:00:00+00:00'], E dtype='datetime64[ns, tzlocal()]', length=131041, freq='T') E [right]: 131101, DatetimeIndex(['2014-08-01 00:00:00+01:00', '2014-08-01 00:01:00+01:00', E '2014-08-01 00:02:00+01:00', '2014-08-01 00:03:00+01:00', E '2014-08-01 00:04:00+01:00', '2014-08-01 00:05:00+01:00', E '2014-08-01 00:06:00+01:00', '2014-08-01 00:07:00+01:00', E '2014-08-01 00:08:00+01:00', '2014-08-01 00:09:00+01:00', E ... E '2014-10-30 23:51:00+00:00', '2014-10-30 23:52:00+00:00', E '2014-10-30 23:53:00+00:00', '2014-10-30 23:54:00+00:00', E '2014-10-30 23:55:00+00:00', '2014-10-30 23:56:00+00:00', E '2014-10-30 23:57:00+00:00', '2014-10-30 23:58:00+00:00', E '2014-10-30 23:59:00+00:00', '2014-10-31 00:00:00+00:00'], E dtype='datetime64[ns, tzlocal()]', length=131101, freq='T') pandas/tests/indexes/datetimes/test_timezones.py:448: AssertionErrorProblem description
Fails locally but passes in CI on the same commit. Its because the test fixture includes tzlocal(), and for some timezones (incl most of europe), one of the testcases spans a DST transition:
date_range(start='2014-08-01', end='2014-10-31', freq='T')
Expected Output
should pass, regardless of the local timezone
Output of pd.show_versions()
 INSTALLED VERSIONS
commit: 7c842b0
 python: 3.7.2.final.0
 python-bits: 64
 OS: Darwin
 OS-release: 18.2.0
 machine: x86_64
 processor: i386
 byteorder: little
 LC_ALL: None
 LANG: en_GB.UTF-8
 LOCALE: en_GB.UTF-8
pandas: 0.24.0.dev0+1539.g7c842b031
 pytest: 4.0.2
 pip: 18.1
 setuptools: 40.6.2
 Cython: 0.29.2
 numpy: 1.15.4
 scipy: 1.1.0
 pyarrow: None
 xarray: None
 IPython: 7.2.0
 sphinx: 1.8.2
 patsy: 0.5.1
 dateutil: 2.7.5
 pytz: 2018.7
 blosc: None
 bottleneck: 1.2.1
 tables: 3.4.4
 numexpr: 2.6.8
 feather: None
 matplotlib: 3.0.2
 openpyxl: 2.5.12
 xlrd: 1.2.0
 xlwt: 1.3.0
 xlsxwriter: 1.1.2
 lxml.etree: 4.2.5
 bs4: 4.6.3
 html5lib: 1.0.1
 sqlalchemy: 1.2.15
 pymysql: 0.9.2
 psycopg2: None
 jinja2: 2.10
 s3fs: 0.2.0
 fastparquet: None
 pandas_gbq: None
 pandas_datareader: None
 gcsfs: 0.2.0