From b49b7821b7d69a7fc43a1e9150b799f39bb85986 Mon Sep 17 00:00:00 2001 From: Spencer Clark Date: Sat, 21 Mar 2020 08:55:54 -0400 Subject: [PATCH 1/4] Re-enable tests xfailed in #3808 --- xarray/tests/test_cftimeindex.py | 17 ++--------------- xarray/tests/test_interp.py | 4 ---- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/xarray/tests/test_cftimeindex.py b/xarray/tests/test_cftimeindex.py index 43d6d7b068e..d31bf9471ea 100644 --- a/xarray/tests/test_cftimeindex.py +++ b/xarray/tests/test_cftimeindex.py @@ -450,7 +450,6 @@ def test_sel_date_scalar(da, date_type, index): assert_identical(result, expected) -@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751") @requires_cftime def test_sel_date_distant_date(da, date_type, index): expected = xr.DataArray(4).assign_coords(time=index[3]) @@ -513,12 +512,7 @@ def test_sel_date_scalar_backfill(da, date_type, index, sel_kwargs): [ {"method": "pad", "tolerance": timedelta(days=20)}, {"method": "backfill", "tolerance": timedelta(days=20)}, - pytest.param( - {"method": "nearest", "tolerance": timedelta(days=20)}, - marks=pytest.mark.xfail( - reason="https://github.com/pydata/xarray/issues/3751" - ), - ), + {"method": "nearest", "tolerance": timedelta(days=20)}, ], ) def test_sel_date_scalar_tolerance_raises(da, date_type, sel_kwargs): @@ -526,7 +520,6 @@ def test_sel_date_scalar_tolerance_raises(da, date_type, sel_kwargs): da.sel(time=date_type(1, 5, 1), **sel_kwargs) -@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751") @requires_cftime @pytest.mark.parametrize( "sel_kwargs", @@ -574,12 +567,7 @@ def test_sel_date_list_backfill(da, date_type, index, sel_kwargs): [ {"method": "pad", "tolerance": timedelta(days=20)}, {"method": "backfill", "tolerance": timedelta(days=20)}, - pytest.param( - {"method": "nearest", "tolerance": timedelta(days=20)}, - marks=pytest.mark.xfail( - reason="https://github.com/pydata/xarray/issues/3751" - ), - ), + {"method": "nearest", "tolerance": timedelta(days=20)}, ], ) def test_sel_date_list_tolerance_raises(da, date_type, sel_kwargs): @@ -614,7 +602,6 @@ def range_args(date_type): ] -@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751") @requires_cftime def test_indexing_in_series_getitem(series, index, scalar_args, range_args): for arg in scalar_args: diff --git a/xarray/tests/test_interp.py b/xarray/tests/test_interp.py index 9cc4933f462..0502348160e 100644 --- a/xarray/tests/test_interp.py +++ b/xarray/tests/test_interp.py @@ -586,7 +586,6 @@ def test_datetime_single_string(): assert_allclose(actual.drop_vars("time"), expected) -@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751") @requires_cftime @requires_scipy def test_cftime(): @@ -613,7 +612,6 @@ def test_cftime_type_error(): da.interp(time=times_new) -@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751") @requires_cftime @requires_scipy def test_cftime_list_of_strings(): @@ -635,7 +633,6 @@ def test_cftime_list_of_strings(): assert_allclose(actual, expected) -@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751") @requires_cftime @requires_scipy def test_cftime_single_string(): @@ -697,7 +694,6 @@ def test_datetime_interp_noerror(): a.interp(x=xi, time=xi.time) # should not raise an error -@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751") @requires_cftime def test_3641(): times = xr.cftime_range("0001", periods=3, freq="500Y") From 5f37fd4f47ed3e258cd4f72ff40d73fa2b097ba4 Mon Sep 17 00:00:00 2001 From: Spencer Clark Date: Sat, 21 Mar 2020 09:46:44 -0400 Subject: [PATCH 2/4] Add _cache attribute to CFTimeIndex --- xarray/coding/cftimeindex.py | 1 + 1 file changed, 1 insertion(+) diff --git a/xarray/coding/cftimeindex.py b/xarray/coding/cftimeindex.py index c680a7e0bcf..2e42702caac 100644 --- a/xarray/coding/cftimeindex.py +++ b/xarray/coding/cftimeindex.py @@ -253,6 +253,7 @@ def __new__(cls, data, name=None): result = object.__new__(cls) result._data = np.array(data, dtype="O") result.name = name + result._cache = {} return result def _partial_date_slice(self, resolution, parsed): From 4889bd66a773ef9f151c73c0967a55b79d47771b Mon Sep 17 00:00:00 2001 From: Spencer Clark Date: Sat, 21 Mar 2020 15:20:15 -0400 Subject: [PATCH 3/4] Temporarily install pandas master from GitHub instead of wheel --- ci/azure/install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/azure/install.yml b/ci/azure/install.yml index 958e3c180fa..5c19781c380 100644 --- a/ci/azure/install.yml +++ b/ci/azure/install.yml @@ -19,7 +19,6 @@ steps: --upgrade \ matplotlib \ numpy \ - pandas \ scipy python -m pip install \ --no-deps \ @@ -30,7 +29,8 @@ steps: git+https://github.com/Unidata/cftime \ git+https://github.com/mapbox/rasterio \ git+https://github.com/hgrecco/pint \ - git+https://github.com/pydata/bottleneck + git+https://github.com/pydata/bottleneck \ + git+https://github.com/pandas-dev/pandas.git condition: eq(variables['UPSTREAM_DEV'], 'true') displayName: Install upstream dev dependencies From cbf0e11cee8c6e428215e3655f2c63962847ab25 Mon Sep 17 00:00:00 2001 From: Spencer Clark Date: Sat, 21 Mar 2020 15:22:03 -0400 Subject: [PATCH 4/4] Fix pandas url --- ci/azure/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/azure/install.yml b/ci/azure/install.yml index 5c19781c380..60559dd2064 100644 --- a/ci/azure/install.yml +++ b/ci/azure/install.yml @@ -30,7 +30,7 @@ steps: git+https://github.com/mapbox/rasterio \ git+https://github.com/hgrecco/pint \ git+https://github.com/pydata/bottleneck \ - git+https://github.com/pandas-dev/pandas.git + git+https://github.com/pandas-dev/pandas condition: eq(variables['UPSTREAM_DEV'], 'true') displayName: Install upstream dev dependencies