Trying to make travis print warnings

This commit is contained in:
Alan Saul 2015-08-19 10:10:41 +01:00
parent 624d65493c
commit 80161665b8
2 changed files with 6 additions and 5 deletions

View file

@ -9,7 +9,7 @@ import inspect
from GPy.likelihoods import link_functions from GPy.likelihoods import link_functions
from GPy.core.parameterization import Param from GPy.core.parameterization import Param
from functools import partial from functools import partial
fixed_seed = 0 fixed_seed = 7
#np.seterr(divide='raise') #np.seterr(divide='raise')
def dparam_partial(inst_func, *args): def dparam_partial(inst_func, *args):
@ -628,7 +628,7 @@ class TestNoiseModels(object):
L = GPy.util.linalg.jitchol(k) L = GPy.util.linalg.jitchol(k)
mu = L.dot(np.random.randn(*Y.shape)) mu = L.dot(np.random.randn(*Y.shape))
#Variance must be positive #Variance must be positive
var = np.abs(L.dot(np.random.randn(*Y.shape))) var = np.abs(L.dot(np.random.randn(*Y.shape))) + 0.01
expectation = model.variational_expectations(Y=Y, m=mu, v=var, gh_points=None, Y_metadata=Y_metadata)[0] expectation = model.variational_expectations(Y=Y, m=mu, v=var, gh_points=None, Y_metadata=Y_metadata)[0]
@ -656,7 +656,7 @@ class TestNoiseModels(object):
L = GPy.util.linalg.jitchol(k) L = GPy.util.linalg.jitchol(k)
mu = L.dot(np.random.randn(*Y.shape)) mu = L.dot(np.random.randn(*Y.shape))
#Variance must be positive #Variance must be positive
var = np.abs(L.dot(np.random.randn(*Y.shape))) var = np.abs(L.dot(np.random.randn(*Y.shape))) + 0.01
expectation = functools.partial(model.variational_expectations, Y=Y, v=var, gh_points=None, Y_metadata=Y_metadata) expectation = functools.partial(model.variational_expectations, Y=Y, v=var, gh_points=None, Y_metadata=Y_metadata)
#Function to get the nth returned value #Function to get the nth returned value
@ -680,7 +680,7 @@ class TestNoiseModels(object):
L = GPy.util.linalg.jitchol(k) L = GPy.util.linalg.jitchol(k)
mu = L.dot(np.random.randn(*Y.shape)) mu = L.dot(np.random.randn(*Y.shape))
#Variance must be positive #Variance must be positive
var = np.abs(L.dot(np.random.randn(*Y.shape))) var = np.abs(L.dot(np.random.randn(*Y.shape))) + 0.01
expectation = functools.partial(model.variational_expectations, Y=Y, m=mu, gh_points=None, Y_metadata=Y_metadata) expectation = functools.partial(model.variational_expectations, Y=Y, m=mu, gh_points=None, Y_metadata=Y_metadata)
#Function to get the nth returned value #Function to get the nth returned value
@ -692,7 +692,7 @@ class TestNoiseModels(object):
grad = GradientChecker(F, dvar, var.copy(), 'v') grad = GradientChecker(F, dvar, var.copy(), 'v')
self.constrain_positive('v', grad) self.constrain_positive('v', grad)
grad.randomize() #grad.randomize()
print(grad) print(grad)
print(model) print(model)
assert grad.checkgrad(verbose=1) assert grad.checkgrad(verbose=1)

View file

@ -13,6 +13,7 @@ class MiscTests(np.testing.TestCase):
def test_safe_exp_upper(self): def test_safe_exp_upper(self):
with warnings.catch_warnings(record=True) as w: with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always') # always print
assert np.isfinite(np.exp(self._lim_val_exp)) assert np.isfinite(np.exp(self._lim_val_exp))
assert np.isinf(np.exp(self._lim_val_exp + 1)) assert np.isinf(np.exp(self._lim_val_exp + 1))
assert np.isfinite(GPy.util.misc.safe_exp(self._lim_val_exp + 1)) assert np.isfinite(GPy.util.misc.safe_exp(self._lim_val_exp + 1))