Skip to content

Commit

Permalink
Merge pull request #1549 from jseabold/test-fails
Browse files Browse the repository at this point in the history
TST: Fix locally failing tests.
  • Loading branch information
jseabold committed Apr 4, 2014
2 parents 24f862c + fef2de3 commit 726bd90
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
5 changes: 2 additions & 3 deletions statsmodels/base/tests/test_generic_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@
Author: Josef Perktold
"""

import pickle
import numpy as np
import statsmodels.api as sm
from statsmodels.compatnp.np_compat import NumpyVersion

from numpy.testing import assert_, assert_allclose
from numpy.testing.decorators import knownfailureif

from nose import SkipTest
import platform


iswin = platform.system() == 'Windows'
npversionless15 = np.__version__ < '1.5'
npversionless15 = NumpyVersion(np.__version__) < '1.5.0'
winoldnp = iswin & npversionless15


Expand Down
4 changes: 2 additions & 2 deletions statsmodels/graphics/tests/test_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@dec.skipif(not have_matplotlib)
def test_plot_corr():
hie_data = randhie.load_pandas()
corr_matrix = np.corrcoef(hie_data.data.T)
corr_matrix = np.corrcoef(hie_data.data.values.T)

fig = plot_corr(corr_matrix, xnames=hie_data.names)
plt.close(fig)
Expand All @@ -30,7 +30,7 @@ def test_plot_corr():
@dec.skipif(not have_matplotlib)
def test_plot_corr_grid():
hie_data = randhie.load_pandas()
corr_matrix = np.corrcoef(hie_data.data.T)
corr_matrix = np.corrcoef(hie_data.data.values.T)

fig = plot_corr_grid([corr_matrix] * 2, xnames=hie_data.names)
plt.close(fig)
Expand Down
11 changes: 5 additions & 6 deletions statsmodels/graphics/tests/test_tsaplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@ def test_plot_quarter():
quarter_plot(dta.unemp)

# w freq
dta.set_index(pd.DatetimeIndex((x[0] for x in map(parser, dates)),
freq='QS-Oct'),
inplace=True)
# see pandas #6631
dta.index = pd.DatetimeIndex((x[0] for x in map(parser, dates)),
freq='QS-Oct')
quarter_plot(dta.unemp)

# w PeriodIndex
dta.set_index(pd.PeriodIndex((x[0] for x in map(parser, dates)),
freq='Q'),
inplace=True)
dta.index = pd.PeriodIndex((x[0] for x in map(parser, dates)),
freq='Q')
quarter_plot(dta.unemp)
10 changes: 5 additions & 5 deletions statsmodels/sandbox/regression/tests/test_gmm_poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


import numpy as np
from numpy.testing.decorators import knownfailureif
from numpy.testing.decorators import skipif
import pandas
import scipy
from scipy import stats
Expand All @@ -15,9 +15,9 @@
from statsmodels.sandbox.regression import gmm

from numpy.testing import assert_allclose, assert_equal
from statsmodels.sandbox.regression.tests import results_gmm_poisson as results
from statsmodels.compatnp.np_compat import NumpyVersion

SCIPY_GT_12 =scipy.version.short_version > '0.12.0'
SCIPY_GT_12 = NumpyVersion(scipy.version.short_version) > '0.12.0'

def get_data():
import os
Expand Down Expand Up @@ -91,7 +91,7 @@ class CheckGMM(object):
q_tol = [5e-6, 1e-9]
j_tol = [5e-5, 1e-9]

@knownfailureif(SCIPY_GT_12,"Known failure with SciPy > 0.12")
@skipif(SCIPY_GT_12,"Known failure with SciPy > 0.12")
def test_basic(self):
res1, res2 = self.res1, self.res2
# test both absolute and relative difference
Expand All @@ -103,7 +103,7 @@ def test_basic(self):
assert_allclose(res1.bse, res2.bse, rtol=rtol, atol=0)
assert_allclose(res1.bse, res2.bse, rtol=0, atol=atol)

@knownfailureif(SCIPY_GT_12,"Known failure with SciPy > 0.12")
@skipif(SCIPY_GT_12,"Known failure with SciPy > 0.12")
def test_other(self):
res1, res2 = self.res1, self.res2
rtol, atol = self.q_tol
Expand Down
4 changes: 2 additions & 2 deletions statsmodels/stats/tests/test_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ def test_pvalcorrection_reject():
#print 'reject.sum', v[1], reject.sum()
msg = 'case %s %3.2f rejected:%d\npval_raw=%r\npvalscorr=%r' % (
method, alpha, reject.sum(), pval1, pvalscorr)
#assert_equal(reject, pvalscorr <= alpha, err_msg=msg)
yield assert_equal, reject, pvalscorr <= alpha, msg
assert_equal(reject, pvalscorr <= alpha, err_msg=msg)
#yield assert_equal, reject, pvalscorr <= alpha #, msg


def test_hommel():
Expand Down
5 changes: 3 additions & 2 deletions statsmodels/tools/tests/test_parallel.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import warnings
from statsmodels.tools.parallel import parallel_func
from statsmodels.tools.sm_exceptions import ModuleUnavailableWarning
from pandas.util.testing import assert_produces_warning
from numpy import arange, testing
from math import sqrt

def test_parallel():
x = arange(10.)
with assert_produces_warning(ModuleUnavailableWarning):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
parallel, p_func, n_jobs = parallel_func(sqrt, n_jobs=-1, verbose=0)
y = parallel(p_func(i**2) for i in range(10))
testing.assert_equal(x,y)

0 comments on commit 726bd90

Please sign in to comment.