[Scipy-svn] r3914 - trunk/scipy/testing
scipy-svn at scipy.org
scipy-svn at scipy.org
Mon Feb 11 18:14:13 EST 2008
Author: matthew.brett at gmail.com
Date: 2008-02-11 17:13:58 -0600 (Mon, 11 Feb 2008)
New Revision: 3914
Modified:
trunk/scipy/testing/nulltester.py
trunk/scipy/testing/pkgtester.py
Log:
Nose version check
Modified: trunk/scipy/testing/nulltester.py
===================================================================
--- trunk/scipy/testing/nulltester.py 2008-02-11 13:46:25 UTC (rev 3913)
+++ trunk/scipy/testing/nulltester.py 2008-02-11 23:13:58 UTC (rev 3914)
@@ -1,18 +1,19 @@
-''' Null tester (when nose not importable)
+''' Null tester to signal nose tests disabled
-Merely returns error reporting lack of nose package
+Merely returns error reporting lack of nose package or version number
+below requirements.
See pkgtester, nosetester modules
'''
-nose_url = 'http://somethingaboutorange.com/mrl/projects/nose'
-
class NullTester(object):
+ _msg = 'Need nose >=0.10 for tests - see %s' % \
+ 'http://somethingaboutorange.com/mrl/projects/nose'
def __init__(self, *args, **kwargs):
pass
def test(self, labels=None, *args, **kwargs):
- raise ImportError, 'Need nose for tests - see %s' % nose_url
+ raise ImportError, self._msg
def bench(self, labels=None, *args, **kwargs):
- raise ImportError, 'Need nose for benchmarks - see %s' % nose_url
+ raise ImportError, self._msg
Modified: trunk/scipy/testing/pkgtester.py
===================================================================
--- trunk/scipy/testing/pkgtester.py 2008-02-11 13:46:25 UTC (rev 3913)
+++ trunk/scipy/testing/pkgtester.py 2008-02-11 23:13:58 UTC (rev 3914)
@@ -1,8 +1,9 @@
''' Define test function for scipy package
-Module tests for presence of nose. If present returns NoseTester,
-otherwise returns a placeholder test routine reporting lack of nose
-and inability to run tests. Typical use is in module __init__:
+Module tests for presence of useful version of nose. If present
+returns NoseTester, otherwise returns a placeholder test routine
+reporting lack of nose and inability to run tests. Typical use is in
+module __init__:
from scipy.testing.pkgtester import Tester
test = Tester().test
@@ -10,10 +11,17 @@
See nosetester module for test implementation
'''
+fine_nose = True
try:
import nose
except ImportError:
- from scipy.testing.nulltester import NullTester as Tester
+ fine_nose = False
else:
+ nose_version = nose.__versioninfo__
+ if nose_version[0] < 1 and nose_version[1] < 10:
+ fine_nose = False
+
+if fine_nose:
from scipy.testing.nosetester import NoseTester as Tester
-
+else:
+ from scipy.testing.nulltester import NullTester as Tester
More information about the Scipy-svn
mailing list