From 92222176fec4a16b625f560b1132cae60efeca1d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 23 Jun 2020 04:32:16 -0400 Subject: [PATCH] Backport patch to fix tests catching too many warnings. --- 3930.patch | 53 ++++++++++++++++++++++++++++++++++++++++++++++ python-xarray.spec | 8 +++++-- 2 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 3930.patch diff --git a/3930.patch b/3930.patch new file mode 100644 index 0000000..2aabda7 --- /dev/null +++ b/3930.patch @@ -0,0 +1,53 @@ +From 67c0d933d5860088ec905a2491e952560f37e476 Mon Sep 17 00:00:00 2001 +From: Spencer Clark +Date: Fri, 3 Apr 2020 08:03:07 -0400 +Subject: [PATCH] Only fail if a specific warning occurs + +--- + xarray/tests/test_backends.py | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/xarray/tests/test_backends.py b/xarray/tests/test_backends.py +index 82fe1b3814..b26a3b37fc 100644 +--- a/xarray/tests/test_backends.py ++++ b/xarray/tests/test_backends.py +@@ -4334,6 +4334,12 @@ def test_source_encoding_always_present(): + assert ds.encoding["source"] == tmp + + ++def _assert_no_dates_out_of_range_warning(record): ++ undesired_message = "dates out of range" ++ for warning in record: ++ assert undesired_message not in str(warning.message) ++ ++ + @requires_scipy_or_netCDF4 + @pytest.mark.parametrize("calendar", _STANDARD_CALENDARS) + def test_use_cftime_standard_calendar_default_in_range(calendar): +@@ -4360,7 +4366,7 @@ def test_use_cftime_standard_calendar_default_in_range(calendar): + with open_dataset(tmp_file) as ds: + assert_identical(expected_x, ds.x) + assert_identical(expected_time, ds.time) +- assert not record ++ _assert_no_dates_out_of_range_warning(record) + + + @requires_cftime +@@ -4423,7 +4429,7 @@ def test_use_cftime_true(calendar, units_year): + with open_dataset(tmp_file, use_cftime=True) as ds: + assert_identical(expected_x, ds.x) + assert_identical(expected_time, ds.time) +- assert not record ++ _assert_no_dates_out_of_range_warning(record) + + + @requires_scipy_or_netCDF4 +@@ -4452,7 +4458,7 @@ def test_use_cftime_false_standard_calendar_in_range(calendar): + with open_dataset(tmp_file, use_cftime=False) as ds: + assert_identical(expected_x, ds.x) + assert_identical(expected_time, ds.time) +- assert not record ++ _assert_no_dates_out_of_range_warning(record) + + + @requires_scipy_or_netCDF4 diff --git a/python-xarray.spec b/python-xarray.spec index 6b4f752..35cf0d1 100644 --- a/python-xarray.spec +++ b/python-xarray.spec @@ -20,6 +20,8 @@ Patch0002: 0002-DOC-Skip-examples-using-unpackaged-dependencies.patch Patch0003: 0003-DOC-Don-t-print-out-conda-pip-environment.patch # https://github.com/pydata/xarray/pull/3274 Patch0004: 0004-Use-drawstyle-instead-of-linestyle-in-plot.step.patch +# https://github.com/pydata/xarray/pull/3930 +Patch0005: https://github.com/pydata/xarray/pull/3930.patch BuildArch: noarch @@ -117,8 +119,7 @@ popd %check rm -rf xarray -PYTHONPATH=%{buildroot}%{python3_sitelib} \ - pytest-3 -ra -n auto -m "not network" --pyargs xarray +%{pytest} -ra -n auto -m "not network" --pyargs xarray %files -n python3-%{srcname} @@ -135,6 +136,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} \ %changelog +* Tue Jun 23 2020 Elliott Sales de Andrade - 0.15.1-3 +- Backport patch to fix tests catching too many warnings + * Tue May 26 2020 Miro HronĨok - 0.15.1-3 - Rebuilt for Python 3.9