[seaborn] 01/01: debian/patches - two patches to resolve FTBFS

Andreas Tille tille at debian.org
Fri Jan 20 15:00:35 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to annotated tag debian/0.4.0-3
in repository seaborn.

commit 76bfa51e12b278753d6a56e269c39d91f3f366ce
Author: Yaroslav Halchenko <debian at onerussian.com>
Date:   Thu Feb 19 21:03:58 2015 -0500

    debian/patches - two patches to resolve FTBFS
    
    * debian/patches - two patches to resolve FTBFS
      - deb_skip_on_olderstatsmodels -- some functionality/tests
        now are skipped on systems with older statsmodels (Closes: #775619)
      - up_relax_tests -- allow for arrays to be almost compare, or
        otherwise tests would fail on 32bit
---
 debian/changelog                            |  10 +++
 debian/patches/deb_skip_on_olderstatsmodels | 105 ++++++++++++++++++++++++++++
 debian/patches/series                       |   2 +
 debian/patches/up_relax_tests               |  61 ++++++++++++++++
 4 files changed, 178 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 418f049..5340227 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+seaborn (0.4.0-3) unstable; urgency=medium
+
+  * debian/patches - two patches to resolve FTBFS
+    - deb_skip_on_olderstatsmodels -- some functionality/tests
+      now are skipped on systems with older statsmodels (Closes: #775619)
+    - up_relax_tests -- allow for arrays to be almost compare, or
+      otherwise tests would fail on 32bit
+
+ -- Yaroslav Halchenko <debian at onerussian.com>  Thu, 19 Feb 2015 21:02:37 -0500
+
 seaborn (0.4.0-2) unstable; urgency=medium
 
   * debian/control
diff --git a/debian/patches/deb_skip_on_olderstatsmodels b/debian/patches/deb_skip_on_olderstatsmodels
new file mode 100644
index 0000000..33c7723
--- /dev/null
+++ b/debian/patches/deb_skip_on_olderstatsmodels
@@ -0,0 +1,105 @@
+--- a/seaborn/distributions.py
++++ b/seaborn/distributions.py
+@@ -9,8 +9,18 @@ import matplotlib.pyplot as plt
+ import warnings
+ 
+ try:
++    import statsmodels
+     import statsmodels.api as sm
+     _has_statsmodels = True
++
++    from distutils.version import LooseVersion as LV
++    _has_statsmodels_ge_0_6 = LV(statsmodels.__version__) >= LV("0.6")
++
++    def needs_statsmodels_0_6():
++        if not _has_statsmodels_ge_0_6:
++            raise RuntimeError("This functionality requires statsmodels 0.6"
++                               " or later. You have %s" % statsmodels.__version__)
++
+ except ImportError:
+     _has_statsmodels = False
+ 
+@@ -670,6 +680,7 @@ def _univariate_kdeplot(data, shade, ver
+ def _statsmodels_univariate_kde(data, kernel, bw, gridsize, cut, clip,
+                                 cumulative=False):
+     """Compute a univariate kernel density estimate using statsmodels."""
++    needs_statsmodels_0_6()
+     fft = kernel == "gau"
+     kde = sm.nonparametric.KDEUnivariate(data)
+     kde.fit(kernel, bw, fft, gridsize=gridsize, cut=cut, clip=clip)
+@@ -738,6 +749,7 @@ def _bivariate_kdeplot(x, y, filled, ker
+ 
+ def _statsmodels_bivariate_kde(x, y, bw, gridsize, cut, clip):
+     """Compute a bivariate kde using statsmodels."""
++    needs_statsmodels_0_6()
+     if isinstance(bw, str):
+         bw_func = getattr(sm.nonparametric.bandwidths, "bw_" + bw)
+         x_bw = bw_func(x)
+--- a/seaborn/tests/test_distributions.py
++++ b/seaborn/tests/test_distributions.py
+@@ -195,6 +195,7 @@ class TestKDE(object):
+                                        self.cut, self.clip)
+ 
+     @skipif(_no_statsmodels)
++    @skipif(not dist._has_statsmodels_ge_0_6)
+     def test_statsmodels_univariate_kde(self):
+         """Test the univariate KDE estimation with statsmodels."""
+         grid, y = dist._statsmodels_univariate_kde(self.x, self.kernel,
+@@ -217,6 +218,7 @@ class TestKDE(object):
+         nt.assert_equal(len(z), self.gridsize)
+ 
+     @skipif(_no_statsmodels)
++    @skipif(not dist._has_statsmodels_ge_0_6)
+     def test_statsmodels_bivariate_kde(self):
+         """Test the bivariate KDE estimation with statsmodels."""
+         clip = [self.clip, self.clip]
+@@ -228,6 +230,7 @@ class TestKDE(object):
+         nt.assert_equal(len(z), self.gridsize)
+ 
+     @skipif(_no_statsmodels)
++    @skipif(not dist._has_statsmodels_ge_0_6)
+     def test_statsmodels_kde_cumulative(self):
+         """Test computation of cumulative KDE."""
+         grid, y = dist._statsmodels_univariate_kde(self.x, self.kernel,
+@@ -302,6 +305,7 @@ class TestJointPlot(object):
+ 
+         plt.close("all")
+ 
++    @skipif(not dist._has_statsmodels_ge_0_6)
+     def test_reg(self):
+ 
+         g = dist.jointplot("x", "y", self.data, kind="reg")
+@@ -346,6 +350,7 @@ class TestJointPlot(object):
+ 
+         plt.close("all")
+ 
++    @skipif(not dist._has_statsmodels_ge_0_6)
+     def test_kde(self):
+ 
+         g = dist.jointplot("x", "y", self.data, kind="kde")
+--- a/seaborn/tests/test_axisgrid.py
++++ b/seaborn/tests/test_axisgrid.py
+@@ -12,6 +12,7 @@ from numpy.testing.decorators import ski
+ from .. import axisgrid as ag
+ from .. import rcmod
+ from ..palettes import color_palette
++from .. import distributions as dist
+ from ..distributions import kdeplot
+ from ..linearmodels import pointplot, pairplot
+ 
+@@ -930,6 +931,7 @@ class TestJointGrid(object):
+         npt.assert_array_equal(y, self.y)
+         plt.close("all")
+ 
++    @skipif(not dist._has_statsmodels_ge_0_6)
+     def test_univariate_plot(self):
+ 
+         g = ag.JointGrid("x", "x", self.data)
+@@ -940,6 +942,7 @@ class TestJointGrid(object):
+         npt.assert_array_equal(y1, y2)
+         plt.close("all")
+ 
++    @skipif(not dist._has_statsmodels_ge_0_6)
+     def test_plot(self):
+ 
+         g = ag.JointGrid("x", "x", self.data)
diff --git a/debian/patches/series b/debian/patches/series
index 866624f..5aefaf9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
 up_3d9f355d8a424a984dd6f2de9719658cb1e9f715
+up_relax_tests
+deb_skip_on_olderstatsmodels
diff --git a/debian/patches/up_relax_tests b/debian/patches/up_relax_tests
new file mode 100644
index 0000000..c5d87a9
--- /dev/null
+++ b/debian/patches/up_relax_tests
@@ -0,0 +1,61 @@
+From: Yaroslav Halchenko <debian at onerussian.com>
+Subject: on 32bit tests fail because of imho lacking some precision so should be safe to ignore
+
+Last-Update: 2015-02-19
+
+--- a/seaborn/tests/test_linearmodels.py
++++ b/seaborn/tests/test_linearmodels.py
+@@ -281,7 +281,7 @@ class TestRegressionPlotter(object):
+         x, y, ci = p.estimate_data
+ 
+         npt.assert_array_equal(x, np.sort(np.unique(self.df.d)))
+-        npt.assert_array_equal(y, self.df.groupby("d").y.mean())
++        npt.assert_array_almost_equal(y, self.df.groupby("d").y.mean())
+         npt.assert_array_less(np.array(ci)[:, 0], y)
+         npt.assert_array_less(y, np.array(ci)[:, 1])
+ 
+@@ -564,7 +564,7 @@ class TestDiscretePlotter(object):
+         npt.assert_array_equal(pos, [0, 1, 2])
+ 
+         height_want = self.df.groupby("x").y.mean()
+-        npt.assert_array_equal(height, height_want)
++        npt.assert_array_almost_equal(height, height_want)
+ 
+         get_cis = lambda x: utils.ci(algo.bootstrap(x, random_seed=0), 95)
+         ci_want = np.array(self.df.groupby("x").y.apply(get_cis).tolist())
+@@ -580,7 +580,7 @@ class TestDiscretePlotter(object):
+         npt.assert_array_equal(pos, [-.2, .8, 1.8])
+ 
+         height_want = first_hue.groupby("x").y.mean()
+-        npt.assert_array_equal(height, height_want)
++        npt.assert_array_almost_equal(height, height_want)
+ 
+         ci_want = np.array(first_hue.groupby("x").y.apply(get_cis).tolist())
+         npt.assert_array_almost_equal(np.squeeze(ci), ci_want, 1)
+@@ -591,7 +591,7 @@ class TestDiscretePlotter(object):
+         npt.assert_array_equal(pos, [.2, 1.2, 2.2])
+ 
+         height_want = second_hue.groupby("x").y.mean()
+-        npt.assert_array_equal(height, height_want)
++        npt.assert_array_almost_equal(height, height_want)
+ 
+         ci_want = np.array(second_hue.groupby("x").y.apply(get_cis).tolist())
+         npt.assert_array_almost_equal(np.squeeze(ci), ci_want, 1)
+@@ -708,7 +708,7 @@ class TestDiscretePlots(object):
+ 
+         x, y = ax.collections[0].get_offsets().T
+         npt.assert_array_equal(x, np.arange(3))
+-        npt.assert_array_equal(y, self.df.groupby("x").y.mean())
++        npt.assert_array_almost_equal(y, self.df.groupby("x").y.mean())
+ 
+         f, ax = plt.subplots()
+         lm.pointplot("x", "y", "g", data=self.df, join=False, ax=ax)
+@@ -716,7 +716,7 @@ class TestDiscretePlots(object):
+         x, y = ax.collections[0].get_offsets().T
+         npt.assert_array_equal(x, np.arange(3))
+         expected_y = self.df[self.df.g == "x"].groupby("x").y.mean()
+-        npt.assert_array_equal(y, expected_y)
++        npt.assert_array_almost_equal(y, expected_y)
+ 
+         plt.close("all")
+ 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/seaborn.git



More information about the debian-science-commits mailing list