From fc388ad6ae6c5d2720423f63fd22243c50b5602b Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Sun, 11 Mar 2018 18:19:06 -0400 Subject: [PATCH] CI: update tests for dateutil >= 2.7.0 closes #18332 --- ci/requirements-3.6_NUMPY_DEV.build.sh | 3 +- pandas/conftest.py | 10 ---- pandas/tests/indexes/datetimes/test_tools.py | 23 --------- pandas/tests/tslibs/test_parsing.py | 54 -------------------- 4 files changed, 1 insertion(+), 89 deletions(-) diff --git a/ci/requirements-3.6_NUMPY_DEV.build.sh b/ci/requirements-3.6_NUMPY_DEV.build.sh index 9145bf1d3481c..fd79142c5cebb 100644 --- a/ci/requirements-3.6_NUMPY_DEV.build.sh +++ b/ci/requirements-3.6_NUMPY_DEV.build.sh @@ -12,8 +12,7 @@ PRE_WHEELS="https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf pip install --pre --upgrade --timeout=60 -f $PRE_WHEELS numpy scipy # install dateutil from master -# pip install -U git+git://github.com/dateutil/dateutil.git -pip install dateutil +pip install -U git+git://github.com/dateutil/dateutil.git # cython via pip pip install cython diff --git a/pandas/conftest.py b/pandas/conftest.py index 37f0a2f818a3b..5eca467746157 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -1,9 +1,7 @@ import pytest -from distutils.version import LooseVersion import numpy import pandas -import dateutil import pandas.util._test_decorators as td @@ -68,14 +66,6 @@ def ip(): return InteractiveShell() -is_dateutil_le_261 = pytest.mark.skipif( - LooseVersion(dateutil.__version__) > LooseVersion('2.6.1'), - reason="dateutil api change version") -is_dateutil_gt_261 = pytest.mark.skipif( - LooseVersion(dateutil.__version__) <= LooseVersion('2.6.1'), - reason="dateutil stable version") - - @pytest.fixture(params=[None, 'gzip', 'bz2', 'zip', pytest.param('xz', marks=td.skip_if_no_lzma)]) def compression(request): diff --git a/pandas/tests/indexes/datetimes/test_tools.py b/pandas/tests/indexes/datetimes/test_tools.py index 0d42b6e9692fe..fb7677bb1449c 100644 --- a/pandas/tests/indexes/datetimes/test_tools.py +++ b/pandas/tests/indexes/datetimes/test_tools.py @@ -12,7 +12,6 @@ from distutils.version import LooseVersion import pandas as pd -from pandas.conftest import is_dateutil_le_261, is_dateutil_gt_261 from pandas._libs import tslib from pandas._libs.tslibs import parsing from pandas.core.tools import datetimes as tools @@ -1058,7 +1057,6 @@ def test_dayfirst(self, cache): class TestGuessDatetimeFormat(object): @td.skip_if_not_us_locale - @is_dateutil_le_261 def test_guess_datetime_format_for_array(self): expected_format = '%Y-%m-%d %H:%M:%S.%f' dt_string = datetime(2011, 12, 30, 0, 0, 0).strftime(expected_format) @@ -1078,27 +1076,6 @@ def test_guess_datetime_format_for_array(self): [np.nan, np.nan, np.nan], dtype='O')) assert format_for_string_of_nans is None - @td.skip_if_not_us_locale - @is_dateutil_gt_261 - def test_guess_datetime_format_for_array_gt_261(self): - expected_format = '%Y-%m-%d %H:%M:%S.%f' - dt_string = datetime(2011, 12, 30, 0, 0, 0).strftime(expected_format) - - test_arrays = [ - np.array([dt_string, dt_string, dt_string], dtype='O'), - np.array([np.nan, np.nan, dt_string], dtype='O'), - np.array([dt_string, 'random_string'], dtype='O'), - ] - - for test_array in test_arrays: - assert tools._guess_datetime_format_for_array( - test_array) is None - - format_for_string_of_nans = tools._guess_datetime_format_for_array( - np.array( - [np.nan, np.nan, np.nan], dtype='O')) - assert format_for_string_of_nans is None - class TestToDatetimeInferFormat(object): diff --git a/pandas/tests/tslibs/test_parsing.py b/pandas/tests/tslibs/test_parsing.py index 34cce088a8b42..14c9ca1f6cc54 100644 --- a/pandas/tests/tslibs/test_parsing.py +++ b/pandas/tests/tslibs/test_parsing.py @@ -8,7 +8,6 @@ from dateutil.parser import parse import pandas.util._test_decorators as td -from pandas.conftest import is_dateutil_le_261, is_dateutil_gt_261 from pandas import compat from pandas.util import testing as tm from pandas._libs.tslibs import parsing @@ -96,7 +95,6 @@ def test_parsers_monthfreq(self): class TestGuessDatetimeFormat(object): @td.skip_if_not_us_locale - @is_dateutil_le_261 @pytest.mark.parametrize( "string, format", [ @@ -112,19 +110,6 @@ def test_guess_datetime_format_with_parseable_formats( result = parsing._guess_datetime_format(string) assert result == format - @td.skip_if_not_us_locale - @is_dateutil_gt_261 - @pytest.mark.parametrize( - "string", - ['20111230', '2011-12-30', '30-12-2011', - '2011-12-30 00:00:00', '2011-12-30T00:00:00', - '2011-12-30 00:00:00.000000']) - def test_guess_datetime_format_with_parseable_formats_gt_261( - self, string): - result = parsing._guess_datetime_format(string) - assert result is None - - @is_dateutil_le_261 @pytest.mark.parametrize( "dayfirst, expected", [ @@ -136,17 +121,7 @@ def test_guess_datetime_format_with_dayfirst(self, dayfirst, expected): ambiguous_string, dayfirst=dayfirst) assert result == expected - @is_dateutil_gt_261 - @pytest.mark.parametrize( - "dayfirst", [True, False]) - def test_guess_datetime_format_with_dayfirst_gt_261(self, dayfirst): - ambiguous_string = '01/01/2011' - result = parsing._guess_datetime_format( - ambiguous_string, dayfirst=dayfirst) - assert result is None - @td.skip_if_has_locale - @is_dateutil_le_261 @pytest.mark.parametrize( "string, format", [ @@ -158,19 +133,6 @@ def test_guess_datetime_format_with_locale_specific_formats( result = parsing._guess_datetime_format(string) assert result == format - @td.skip_if_has_locale - @is_dateutil_gt_261 - @pytest.mark.parametrize( - "string", - [ - '30/Dec/2011', - '30/December/2011', - '30/Dec/2011 00:00:00']) - def test_guess_datetime_format_with_locale_specific_formats_gt_261( - self, string): - result = parsing._guess_datetime_format(string) - assert result is None - def test_guess_datetime_format_invalid_inputs(self): # A datetime string must include a year, month and a day for it # to be guessable, in addition to being a string that looks like @@ -189,7 +151,6 @@ def test_guess_datetime_format_invalid_inputs(self): for invalid_dt in invalid_dts: assert parsing._guess_datetime_format(invalid_dt) is None - @is_dateutil_le_261 @pytest.mark.parametrize( "string, format", [ @@ -204,21 +165,6 @@ def test_guess_datetime_format_nopadding(self, string, format): result = parsing._guess_datetime_format(string) assert result == format - @is_dateutil_gt_261 - @pytest.mark.parametrize( - "string", - [ - '2011-1-1', - '30-1-2011', - '1/1/2011', - '2011-1-1 00:00:00', - '2011-1-1 0:0:0', - '2011-1-3T00:00:0']) - def test_guess_datetime_format_nopadding_gt_261(self, string): - # GH 11142 - result = parsing._guess_datetime_format(string) - assert result is None - class TestArrayToDatetime(object): def test_try_parse_dates(self):