[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Patch for pandas RC 884294, someone to sponsor?



Control: tags -1 +patch

Pandas FTBFS on amd64 due to test failure:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884294
I reproduced this FTBFS on my machine (sid/amd64).

This test failure was due to a numpy problem. Upstream workaround
(bypass) is available:
* https://github.com/pandas-dev/pandas/commit/5f2b96bb637f6ddeec169c5ef8ad20013a03c853

Another test failure arose (not related to #884924). The new failure
could be solved by referencing:
* https://github.com/pandas-dev/pandas/issues/17046
* https://github.com/pandas-dev/pandas/pull/17051

For details about more test failures arose when I'm writing this email please
check the patches.

debomatic-amd64 build was successful:
http://debomatic-amd64.debian.net/distribution#unstable/pandas/0.20.3-11/buildlog

git-formatted patches are attached. I can push the commits to salsa if
the fix is fine.
Can someone review and sponsor the Team upload?
Thanks.

pandas (0.20.3-11) unstable; urgency=medium

  * Team upload.
  * Cherry-pick upstream commit 5f2b96bb637f6ddeec169c5ef8ad20013a03c853
    to workaround a numpy bug. (Closes: #884294)
    + patches/up_tst_dont_assert_that_a_bug_exists_in_numpy
  * Cherry-pick upstream commits to fix test failure caused by test_argsort().
    + patches/up_tst_np_argsort_comparison2
  * Workaround test failure of test_basic_indexing() in file
    pandas/tests/series/test_indexing.py .
    + patches/deb_fix_test_failure_test_basic_indexing



-- 
Best,
From 23745eb17f921b42e1b3ee574c2aef0f05d4252f Mon Sep 17 00:00:00 2001
From: Mo Zhou <cdluminate@gmail.com>
Date: Sat, 20 Jan 2018 09:02:43 +0000
Subject: [PATCH 1/7] Cherry-pick upstream commit
 5f2b96bb637f6ddeec169c5ef8ad20013a03c853 to workaround a numpy bug. (Closes:
 #884294)

---
 debian/patches/series                              |  1 +
 .../up_tst_dont_assert_that_a_bug_exists_in_numpy  | 33 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 debian/patches/up_tst_dont_assert_that_a_bug_exists_in_numpy

diff --git a/debian/patches/series b/debian/patches/series
index b0c042d..209965f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,6 +9,7 @@ deb_skip_sequencelike_on_armel
 # 858260.patch
 up_print_versions
 up_network_seaborn
+up_tst_dont_assert_that_a_bug_exists_in_numpy
 dateutil-2.6.1-fixed-ambiguous-tz-dst-be.patch
 mark_tests_working_on_intel.patch
 mark_tests_working_on_intel_s390x.patch
diff --git a/debian/patches/up_tst_dont_assert_that_a_bug_exists_in_numpy b/debian/patches/up_tst_dont_assert_that_a_bug_exists_in_numpy
new file mode 100644
index 0000000..4242da7
--- /dev/null
+++ b/debian/patches/up_tst_dont_assert_that_a_bug_exists_in_numpy
@@ -0,0 +1,33 @@
+From 5f2b96bb637f6ddeec169c5ef8ad20013a03c853 Mon Sep 17 00:00:00 2001
+From: Eric Wieser <wieser.eric@gmail.com>
+Date: Sat, 15 Jul 2017 13:30:03 +0100
+Subject: [PATCH] TST: Don't assert that a bug exists in numpy (#16940)
+
+Better to ignore the warning from the bug, rather than assert the bug is still there
+
+After this change, numpy/numpy#9412 _could_ be backported to fix the bug
+---
+ pandas/tests/test_algos.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/pandas/tests/test_algos.py b/pandas/tests/test_algos.py
+index 9504d2a9426..993dcc4f527 100644
+--- a/pandas/tests/test_algos.py
++++ b/pandas/tests/test_algos.py
+@@ -2,6 +2,7 @@
+ 
+ import numpy as np
+ import pytest
++import warnings
+ 
+ from numpy.random import RandomState
+ from numpy import nan
+@@ -127,7 +128,7 @@ def test_unsortable(self):
+         arr = np.array([1, 2, datetime.now(), 0, 3], dtype=object)
+         if compat.PY2 and not pd._np_version_under1p10:
+             # RuntimeWarning: tp_compare didn't return -1 or -2 for exception
+-            with tm.assert_produces_warning(RuntimeWarning):
++            with warnings.catch_warnings():
+                 pytest.raises(TypeError, algos.safe_sort, arr)
+         else:
+             pytest.raises(TypeError, algos.safe_sort, arr)
-- 
2.15.1

From b92f86abb26073326ec80dffaa017c1e3f77eab5 Mon Sep 17 00:00:00 2001
From: Mo Zhou <cdluminate@gmail.com>
Date: Sat, 20 Jan 2018 09:04:32 +0000
Subject: [PATCH 2/7] dch: finalize, upload to unstable

---
 debian/changelog | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index bed979e..53b0deb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+pandas (0.20.3-11) unstable; urgency=medium
+
+  * Team upload.
+  * Cherry-pick upstream commit 5f2b96bb637f6ddeec169c5ef8ad20013a03c853
+    to workaround a numpy bug. (Closes: #884294)
+
+ -- Mo Zhou <cdluminate@gmail.com>  Sat, 20 Jan 2018 09:00:31 +0000
+
 pandas (0.20.3-10) unstable; urgency=medium
 
   * Team upload.
-- 
2.15.1

From c37cee1b4a9c44522c6bf3d74bceb8f0b20364cd Mon Sep 17 00:00:00 2001
From: Mo Zhou <cdluminate@gmail.com>
Date: Sat, 20 Jan 2018 10:12:15 +0000
Subject: [PATCH 3/7] Cherry-pick upstream commit to fix test failure caused by
 test_argsort()

Reference:
1. https://github.com/pandas-dev/pandas/issues/17010
2. https://github.com/pandas-dev/pandas/issues/17046
3. https://github.com/pandas-dev/pandas/pull/17051
4. https://github.com/pandas-dev/pandas/pull/17051/commits/df6934cad28c33c3eaf584ad3519cc1b9b8e16f4
5. https://github.com/pandas-dev/pandas/pull/17051/commits/480d5745e1443de6e91a9f9c42d94e29705a3f43

Gbp-Dch: Short
---
 debian/patches/series                        |  2 ++
 debian/patches/up_tst_np_argsort_comparison1 | 22 +++++++++++++
 debian/patches/up_tst_np_argsort_comparison2 | 48 ++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+)
 create mode 100644 debian/patches/up_tst_np_argsort_comparison1
 create mode 100644 debian/patches/up_tst_np_argsort_comparison2

diff --git a/debian/patches/series b/debian/patches/series
index 209965f..0a2bd7a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,6 +10,8 @@ deb_skip_sequencelike_on_armel
 up_print_versions
 up_network_seaborn
 up_tst_dont_assert_that_a_bug_exists_in_numpy
+up_tst_np_argsort_comparison1
+up_tst_np_argsort_comparison2
 dateutil-2.6.1-fixed-ambiguous-tz-dst-be.patch
 mark_tests_working_on_intel.patch
 mark_tests_working_on_intel_s390x.patch
diff --git a/debian/patches/up_tst_np_argsort_comparison1 b/debian/patches/up_tst_np_argsort_comparison1
new file mode 100644
index 0000000..ea8e04d
--- /dev/null
+++ b/debian/patches/up_tst_np_argsort_comparison1
@@ -0,0 +1,22 @@
+From df6934cad28c33c3eaf584ad3519cc1b9b8e16f4 Mon Sep 17 00:00:00 2001
+From: ysau <yatshan.au@gmail.com>
+Date: Fri, 21 Jul 2017 21:21:38 -0700
+Subject: [PATCH] # modified: /doc/source/whatsnew/v0.21.0.txt # # undone
+ update to release note
+
+---
+ doc/source/whatsnew/v0.21.0.txt | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/doc/source/whatsnew/v0.21.0.txt b/doc/source/whatsnew/v0.21.0.txt
+index e4c50ec93f9..91d3e9e7b93 100644
+--- a/doc/source/whatsnew/v0.21.0.txt
++++ b/doc/source/whatsnew/v0.21.0.txt
+@@ -259,7 +259,6 @@ Indexing
+ - Fixes bug where indexing with ``np.inf`` caused an ``OverflowError`` to be raised (:issue:`16957`)
+ - Bug in reindexing on an empty ``CategoricalIndex`` (:issue:`16770`)
+ - Fixes ``DataFrame.loc`` for setting with alignment and tz-aware ``DatetimeIndex`` (:issue:`16889`)
+-- Fixes ``test_argsort``, ``test_numpy_argsort`` to cover both `>` and `<` in the error message (:issue:`17046`)
+  
+ I/O
+ ^^^
diff --git a/debian/patches/up_tst_np_argsort_comparison2 b/debian/patches/up_tst_np_argsort_comparison2
new file mode 100644
index 0000000..564c5f9
--- /dev/null
+++ b/debian/patches/up_tst_np_argsort_comparison2
@@ -0,0 +1,48 @@
+From 480d5745e1443de6e91a9f9c42d94e29705a3f43 Mon Sep 17 00:00:00 2001
+From: ysau <yatshan.au@gmail.com>
+Date: Fri, 21 Jul 2017 16:29:12 -0700
+Subject: [PATCH] # Issue 17046 # #    modified:
+ /pandas/tests/indexes/test_base.py, #             
+ /doc/source/whatsnew/v0.21.0.txt # # Include both '>' and '<' in the error
+ message in # TestMixedIntIndex.test_argsort and #
+ TestMixedIntIndex.test_numpy_argsort
+
+---
+ doc/source/whatsnew/v0.21.0.txt   | 1 +
+ pandas/tests/indexes/test_base.py | 4 ++--
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/doc/source/whatsnew/v0.21.0.txt b/doc/source/whatsnew/v0.21.0.txt
+index 91d3e9e7b93..e4c50ec93f9 100644
+--- a/doc/source/whatsnew/v0.21.0.txt
++++ b/doc/source/whatsnew/v0.21.0.txt
+@@ -259,6 +259,7 @@ Indexing
+ - Fixes bug where indexing with ``np.inf`` caused an ``OverflowError`` to be raised (:issue:`16957`)
+ - Bug in reindexing on an empty ``CategoricalIndex`` (:issue:`16770`)
+ - Fixes ``DataFrame.loc`` for setting with alignment and tz-aware ``DatetimeIndex`` (:issue:`16889`)
++- Fixes ``test_argsort``, ``test_numpy_argsort`` to cover both `>` and `<` in the error message (:issue:`17046`)
+  
+ I/O
+ ^^^
+diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py
+index 692cdd49579..842e8fea0df 100644
+--- a/pandas/tests/indexes/test_base.py
++++ b/pandas/tests/indexes/test_base.py
+@@ -1846,7 +1846,7 @@ def create_index(self):
+     def test_argsort(self):
+         idx = self.create_index()
+         if PY36:
+-            with tm.assert_raises_regex(TypeError, "'>' not supported"):
++            with tm.assert_raises_regex(TypeError, "'>|<' not supported"):
+                 result = idx.argsort()
+         elif PY3:
+             with tm.assert_raises_regex(TypeError, "unorderable types"):
+@@ -1859,7 +1859,7 @@ def test_argsort(self):
+     def test_numpy_argsort(self):
+         idx = self.create_index()
+         if PY36:
+-            with tm.assert_raises_regex(TypeError, "'>' not supported"):
++            with tm.assert_raises_regex(TypeError, "'>|<' not supported"):
+                 result = np.argsort(idx)
+         elif PY3:
+             with tm.assert_raises_regex(TypeError, "unorderable types"):
-- 
2.15.1

From f537a570657c704c9db165638e63c7456cf3601e Mon Sep 17 00:00:00 2001
From: Mo Zhou <cdluminate@gmail.com>
Date: Sat, 20 Jan 2018 10:15:31 +0000
Subject: [PATCH 4/7] dch: fix more test failures

---
 debian/changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/changelog b/debian/changelog
index 53b0deb..bdb5184 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ pandas (0.20.3-11) unstable; urgency=medium
   * Team upload.
   * Cherry-pick upstream commit 5f2b96bb637f6ddeec169c5ef8ad20013a03c853
     to workaround a numpy bug. (Closes: #884294)
+  * Cherry-pick upstream commits to fix test failure caused by test_argsort().
 
  -- Mo Zhou <cdluminate@gmail.com>  Sat, 20 Jan 2018 09:00:31 +0000
 
-- 
2.15.1

From 9efab2f352b0955002b9e93aea6c1c61a9c2c6fc Mon Sep 17 00:00:00 2001
From: Mo Zhou <cdluminate@gmail.com>
Date: Sat, 20 Jan 2018 10:21:09 +0000
Subject: [PATCH 5/7] Modify patches since the original ones doesn't apply.

---
 debian/patches/series                        |  1 -
 debian/patches/up_tst_np_argsort_comparison1 | 22 ----------------------
 debian/patches/up_tst_np_argsort_comparison2 | 20 ++++----------------
 3 files changed, 4 insertions(+), 39 deletions(-)
 delete mode 100644 debian/patches/up_tst_np_argsort_comparison1

diff --git a/debian/patches/series b/debian/patches/series
index 0a2bd7a..d3b98e0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,7 +10,6 @@ deb_skip_sequencelike_on_armel
 up_print_versions
 up_network_seaborn
 up_tst_dont_assert_that_a_bug_exists_in_numpy
-up_tst_np_argsort_comparison1
 up_tst_np_argsort_comparison2
 dateutil-2.6.1-fixed-ambiguous-tz-dst-be.patch
 mark_tests_working_on_intel.patch
diff --git a/debian/patches/up_tst_np_argsort_comparison1 b/debian/patches/up_tst_np_argsort_comparison1
deleted file mode 100644
index ea8e04d..0000000
--- a/debian/patches/up_tst_np_argsort_comparison1
+++ /dev/null
@@ -1,22 +0,0 @@
-From df6934cad28c33c3eaf584ad3519cc1b9b8e16f4 Mon Sep 17 00:00:00 2001
-From: ysau <yatshan.au@gmail.com>
-Date: Fri, 21 Jul 2017 21:21:38 -0700
-Subject: [PATCH] # modified: /doc/source/whatsnew/v0.21.0.txt # # undone
- update to release note
-
----
- doc/source/whatsnew/v0.21.0.txt | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/doc/source/whatsnew/v0.21.0.txt b/doc/source/whatsnew/v0.21.0.txt
-index e4c50ec93f9..91d3e9e7b93 100644
---- a/doc/source/whatsnew/v0.21.0.txt
-+++ b/doc/source/whatsnew/v0.21.0.txt
-@@ -259,7 +259,6 @@ Indexing
- - Fixes bug where indexing with ``np.inf`` caused an ``OverflowError`` to be raised (:issue:`16957`)
- - Bug in reindexing on an empty ``CategoricalIndex`` (:issue:`16770`)
- - Fixes ``DataFrame.loc`` for setting with alignment and tz-aware ``DatetimeIndex`` (:issue:`16889`)
--- Fixes ``test_argsort``, ``test_numpy_argsort`` to cover both `>` and `<` in the error message (:issue:`17046`)
-  
- I/O
- ^^^
diff --git a/debian/patches/up_tst_np_argsort_comparison2 b/debian/patches/up_tst_np_argsort_comparison2
index 564c5f9..d688847 100644
--- a/debian/patches/up_tst_np_argsort_comparison2
+++ b/debian/patches/up_tst_np_argsort_comparison2
@@ -7,23 +7,11 @@ Subject: [PATCH] # Issue 17046 # #    modified:
  message in # TestMixedIntIndex.test_argsort and #
  TestMixedIntIndex.test_numpy_argsort
 
----
- doc/source/whatsnew/v0.21.0.txt   | 1 +
- pandas/tests/indexes/test_base.py | 4 ++--
- 2 files changed, 3 insertions(+), 2 deletions(-)
+Modified: Mo Zhou <cdluminate@gmail.com>
+Modification Note: Part of the original patch doesn't apply.
+ Removed modification to doc/source/whatsnew/v0.21.0.txt from the original
+ patch.
 
-diff --git a/doc/source/whatsnew/v0.21.0.txt b/doc/source/whatsnew/v0.21.0.txt
-index 91d3e9e7b93..e4c50ec93f9 100644
---- a/doc/source/whatsnew/v0.21.0.txt
-+++ b/doc/source/whatsnew/v0.21.0.txt
-@@ -259,6 +259,7 @@ Indexing
- - Fixes bug where indexing with ``np.inf`` caused an ``OverflowError`` to be raised (:issue:`16957`)
- - Bug in reindexing on an empty ``CategoricalIndex`` (:issue:`16770`)
- - Fixes ``DataFrame.loc`` for setting with alignment and tz-aware ``DatetimeIndex`` (:issue:`16889`)
-+- Fixes ``test_argsort``, ``test_numpy_argsort`` to cover both `>` and `<` in the error message (:issue:`17046`)
-  
- I/O
- ^^^
 diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py
 index 692cdd49579..842e8fea0df 100644
 --- a/pandas/tests/indexes/test_base.py
-- 
2.15.1

From f9a4f747b3c16fa02c9562784f37c94f647085eb Mon Sep 17 00:00:00 2001
From: Mo Zhou <cdluminate@gmail.com>
Date: Sat, 20 Jan 2018 11:59:45 +0000
Subject: [PATCH 6/7] Fix more test failure.

Reference:
1. https://github.com/pandas-dev/pandas/pull/17724
2. https://github.com/pandas-dev/pandas/issues/17046

Gbp-Dch: Short
---
 .../deb_fix_test_failure_test_basic_indexing       | 43 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 44 insertions(+)
 create mode 100644 debian/patches/deb_fix_test_failure_test_basic_indexing

diff --git a/debian/patches/deb_fix_test_failure_test_basic_indexing b/debian/patches/deb_fix_test_failure_test_basic_indexing
new file mode 100644
index 0000000..eb6035c
--- /dev/null
+++ b/debian/patches/deb_fix_test_failure_test_basic_indexing
@@ -0,0 +1,43 @@
+Purpose: Avoid FTBFS:
+	=================================== FAILURES ===================================
+	____________________ TestSeriesIndexing.test_basic_indexing ____________________
+	
+	self = <pandas.tests.series.test_indexing.TestSeriesIndexing object at 0x7f01582c04e0>
+	
+	    def test_basic_indexing(self):
+	        s = Series(np.random.randn(5), index=['a', 'b', 'a', 'a', 'b'])
+	    
+	        pytest.raises(IndexError, s.__getitem__, 5)
+	        pytest.raises(IndexError, s.__setitem__, 5, 0)
+	    
+	        pytest.raises(KeyError, s.__getitem__, 'c')
+	    
+	        s = s.sort_index()
+	    
+	        pytest.raises(IndexError, s.__getitem__, 5)
+	>       pytest.raises(IndexError, s.__setitem__, 5, 0)
+	E       Failed: DID NOT RAISE <class 'IndexError'>
+	../debian/tmp/usr/lib/python3/dist-packages/pandas/tests/series/test_indexing.py:1631: Failed
+Reference:
+	1. https://github.com/pandas-dev/pandas/issues/17046
+	2. https://github.com/pandas-dev/pandas/pull/17724
+Forward: Not needed. Already fixed in newer releases.
+By: Mo Zhou <cdluminate@gmail.com>, Jan 20 2018
+Note: Please remove this patch when version >= 0.21.
+
+diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py
+index 2eebf37..f538eaf 100644
+--- a/pandas/core/dtypes/common.py
++++ b/pandas/core/dtypes/common.py
+@@ -1155,7 +1155,10 @@ def _is_unorderable_exception(e):
+     """
+ 
+     if PY36:
+-        return "'>' not supported between instances of" in str(e)
++        # Temporary fix for Debian, reference:
++        # https://github.com/pandas-dev/pandas/pull/17724
++        return any("'{}' not supported between instances of".format(op) in
++                   str(e) for op in ('>', '<'))
+ 
+     elif PY3:
+         return 'unorderable' in str(e)
diff --git a/debian/patches/series b/debian/patches/series
index d3b98e0..9c68516 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,6 +3,7 @@ deb_doc_donotoverride_PYTHONPATH
 deb_skip_stata_on_bigendians
 deb_disable_googleanalytics
 deb_skip_sequencelike_on_armel
+deb_fix_test_failure_test_basic_indexing
 # Try to skip -- migth have been addressed upstream
 # deb_skip_test_pytables_failure
 # up_buggy_overflows
-- 
2.15.1

From 634486ddd13d8698716fd2985f13923197512015 Mon Sep 17 00:00:00 2001
From: Mo Zhou <cdluminate@gmail.com>
Date: Sat, 20 Jan 2018 12:06:25 +0000
Subject: [PATCH 7/7] dch: update with more detail

---
 debian/changelog | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index bdb5184..b58a852 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,7 +3,12 @@ pandas (0.20.3-11) unstable; urgency=medium
   * Team upload.
   * Cherry-pick upstream commit 5f2b96bb637f6ddeec169c5ef8ad20013a03c853
     to workaround a numpy bug. (Closes: #884294)
+    + patches/up_tst_dont_assert_that_a_bug_exists_in_numpy
   * Cherry-pick upstream commits to fix test failure caused by test_argsort().
+    + patches/up_tst_np_argsort_comparison2
+  * Workaround test failure of test_basic_indexing() in file
+    pandas/tests/series/test_indexing.py .
+    + patches/deb_fix_test_failure_test_basic_indexing
 
  -- Mo Zhou <cdluminate@gmail.com>  Sat, 20 Jan 2018 09:00:31 +0000
 
-- 
2.15.1


Reply to: