From 625eedd6ac092e1adb2b596632ae3f41a592f434 Mon Sep 17 00:00:00 2001 From: Alan Saul Date: Mon, 3 Nov 2014 11:54:55 +0000 Subject: [PATCH] Catch nosetests import error if not installed, now ignore GPy.tests() when nosetests GPy is called, but allows GPy.tests() to be called, and throws error if this is tried without nose being installed --- GPy/__init__.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/GPy/__init__.py b/GPy/__init__.py index ceff68a0..99a91fe8 100644 --- a/GPy/__init__.py +++ b/GPy/__init__.py @@ -14,7 +14,6 @@ import examples import likelihoods import testing from numpy.testing import Tester -from nose.tools import nottest import kern import plotting @@ -22,10 +21,16 @@ import plotting from core import Model from core.parameterization import Param, Parameterized, ObsAr -@nottest -def tests(): - Tester(testing).test(verbose=10) - +#@nottest +try: + #Get rid of nose dependency by only ignoring if you have nose installed + from nose.tools import nottest + @nottest + def tests(): + Tester(testing).test(verbose=10) +except: + def tests(): + Tester(testing).test(verbose=10) def load(file_path): """ @@ -36,4 +41,4 @@ def load(file_path): import cPickle as pickle with open(file_path, 'rb') as f: m = pickle.load(f) - return m \ No newline at end of file + return m