[Scipy-svn] r3807 - in branches/testing_cleanup/scipy: testing weave/tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Tue Jan 8 20:08:17 EST 2008
Author: matthew.brett at gmail.com
Date: 2008-01-08 19:08:07 -0600 (Tue, 08 Jan 2008)
New Revision: 3807
Modified:
branches/testing_cleanup/scipy/testing/decorators.py
branches/testing_cleanup/scipy/testing/nosetester.py
branches/testing_cleanup/scipy/weave/tests/test_catalog.py
branches/testing_cleanup/scipy/weave/tests/test_ext_tools.py
branches/testing_cleanup/scipy/weave/tests/test_inline_tools.py
branches/testing_cleanup/scipy/weave/tests/test_numpy_scalar_spec.py
branches/testing_cleanup/scipy/weave/tests/test_scxx_dict.py
branches/testing_cleanup/scipy/weave/tests/test_scxx_object.py
branches/testing_cleanup/scipy/weave/tests/test_scxx_sequence.py
branches/testing_cleanup/scipy/weave/tests/test_size_check.py
branches/testing_cleanup/scipy/weave/tests/test_slice_handler.py
branches/testing_cleanup/scipy/weave/tests/test_standard_array_spec.py
branches/testing_cleanup/scipy/weave/tests/weave_test_utils.py
Log:
Absolute paths for weave tests, added willfail decorator
Modified: branches/testing_cleanup/scipy/testing/decorators.py
===================================================================
--- branches/testing_cleanup/scipy/testing/decorators.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/testing/decorators.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -19,3 +19,11 @@
t.bench = True
return t
+
+def willfail(t):
+ ''' Labels test as known failure
+
+ This label allows the tester to deselect the test in standard cases '''
+ t.willfail = True
+ t.__doc__ += '\n\nThis test will likely fail'
+ return t
Modified: branches/testing_cleanup/scipy/testing/nosetester.py
===================================================================
--- branches/testing_cleanup/scipy/testing/nosetester.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/testing/nosetester.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -5,57 +5,32 @@
import nose
class NoseTester(object):
- """ Scipy nose tests suite manager.
+ """ Scipy nose test runner.
- Usage: NoseTester(<package>).test()
+ Usage: NoseTester(<package path>).test()
- <package> is package path, package name or its module object.
+ <package> is package path - None finds calling module path
"""
- def __init__(self, package=None):
- if package is None:
+ def __init__(self, package_path=None):
+ if package_path is None:
f = sys._getframe(1)
- package = f.f_locals.get('__file__', None)
- assert package is not None
- self.package_path = os.path.dirname(package)
- else:
- self.package_path = self._process_package(package)
-
- def _process_package(self, package):
- ''' Package can be module, path, or package name '''
- try:
- pfile = package.__file__
- except AttributeError:
- pass
- else:
- return os.path.dirname(pfile)
- if os.path.isabs(package):
- return package
- if package.find(os.path.sep) == -1:
- # Try scipy package name
- import scipy
- scipy.pkgload(package)
- try:
- module = getattr(scipy, package)
- except AttributeError:
- pass
- else:
- self.package_path = os.path.dirname(module.__file__)
- return
- # Default to relative path
- self.package_path = os.path.abspath(package)
- return
-
+ package_path = f.f_locals.get('__file__', None)
+ assert package_path is not None
+ package_path = os.path.dirname(package_path)
+ self.package_path = package_path
+
def test(self, labels='fast', verbose=1, doctests=False, extra_argv=None):
''' Module testing function
labels - identifies tests to run. This can be a string to
- pass to the nostests executable with the '-A'
+ pass to the nosetests executable with the '-A'
option, or one of several special values.
Special values are:
'fast' - the default - which corresponds to
- nosetests -A option of 'not slow and not bench'.
+ nosetests -A option of
+ 'not slow and not bench and not willfail'.
'full' - fast (as above) and slow tests as in
- nosetests -A option of 'not bench'.
+ nosetests -A option of 'not bench and not willfail'.
None or '' - run all tests and benchmarks
verbose - verbosity value 1-10
@@ -65,9 +40,9 @@
argv = ['scipy module test', self.package_path, '-s']
if labels:
if labels == 'fast':
- labels = 'not slow and not bench'
+ labels = 'not slow and not bench and not willfail'
elif labels == 'full':
- labels = 'not bench'
+ labels = 'not bench and not willfail'
argv += ['-A', labels]
argv += ['--verbosity', str(verbose)]
if doctests:
Modified: branches/testing_cleanup/scipy/weave/tests/test_catalog.py
===================================================================
--- branches/testing_cleanup/scipy/weave/tests/test_catalog.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/weave/tests/test_catalog.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -4,14 +4,13 @@
from scipy.testing import *
-from weave import catalog
+from scipy.weave import catalog
-
set_local_path()
from weave_test_utils import *
+restore_path()
-
class TestDefaultDir(TestCase):
def test_is_writable(self):
path = catalog.default_dir()
Modified: branches/testing_cleanup/scipy/weave/tests/test_ext_tools.py
===================================================================
--- branches/testing_cleanup/scipy/weave/tests/test_ext_tools.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/weave/tests/test_ext_tools.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -3,17 +3,17 @@
from scipy.testing import *
-from weave import ext_tools, c_spec
+from scipy.weave import ext_tools, c_spec
try:
- from weave.standard_array_spec import array_converter
+ from scipy.weave.standard_array_spec import array_converter
except ImportError:
pass # requires numpy.numerix
set_local_path()
from weave_test_utils import *
+restore_path()
-
build_dir = empty_temp_dir()
print 'building extensions here:', build_dir
Modified: branches/testing_cleanup/scipy/weave/tests/test_inline_tools.py
===================================================================
--- branches/testing_cleanup/scipy/weave/tests/test_inline_tools.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/weave/tests/test_inline_tools.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -3,12 +3,12 @@
from scipy.testing import *
-from weave import inline_tools
+from scipy.weave import inline_tools
set_local_path()
from test_scxx import *
+restore_path()
-
class TestInline(TestCase):
""" These are long running tests...
Modified: branches/testing_cleanup/scipy/weave/tests/test_numpy_scalar_spec.py
===================================================================
--- branches/testing_cleanup/scipy/weave/tests/test_numpy_scalar_spec.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/weave/tests/test_numpy_scalar_spec.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -12,14 +12,11 @@
import numpy
from scipy.testing import *
-from weave import inline_tools,ext_tools
-from weave.build_tools import msvc_exists, gcc_exists
-from weave.catalog import unique_file
-from weave.numpy_scalar_spec import numpy_complex_scalar_converter
+from scipy.weave import inline_tools,ext_tools
+from scipy.weave.build_tools import msvc_exists, gcc_exists
+from scipy.weave.catalog import unique_file
+from scipy.weave.numpy_scalar_spec import numpy_complex_scalar_converter
-
-
-
def unique_mod(d,file_name):
f = os.path.basename(unique_file(d,file_name))
m = os.path.splitext(f)[0]
Modified: branches/testing_cleanup/scipy/weave/tests/test_scxx_dict.py
===================================================================
--- branches/testing_cleanup/scipy/weave/tests/test_scxx_dict.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/weave/tests/test_scxx_dict.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -6,7 +6,7 @@
from scipy.testing import *
-from weave import inline_tools
+from scipy.weave import inline_tools
@@ -112,7 +112,8 @@
self.generic_get('return_val = a["b"];')
@dec.slow
- def DOESNT_WORK_check_char_fail(self):
+ @dec.willfail
+ def test_char_fail(self):
# We can't through a KeyError for dicts on RHS of
# = but not on LHS. Not sure how to deal with this.
try:
@@ -134,7 +135,8 @@
self.generic_get(code,['a'])
@dec.slow
- def DOESNT_WORK_check_obj_fail(self):
+ @dec.willfail
+ def test_obj_fail(self):
# We can't through a KeyError for dicts on RHS of
# = but not on LHS. Not sure how to deal with this.
try:
Modified: branches/testing_cleanup/scipy/weave/tests/test_scxx_object.py
===================================================================
--- branches/testing_cleanup/scipy/weave/tests/test_scxx_object.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/weave/tests/test_scxx_object.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -6,7 +6,7 @@
from scipy.testing import *
-from weave import inline_tools
+from scipy.weave import inline_tools
class TestObjectConstruct(TestCase):
Modified: branches/testing_cleanup/scipy/weave/tests/test_scxx_sequence.py
===================================================================
--- branches/testing_cleanup/scipy/weave/tests/test_scxx_sequence.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/weave/tests/test_scxx_sequence.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -6,7 +6,7 @@
from scipy.testing import *
-from weave import inline_tools
+from scipy.weave import inline_tools
# Test:
Modified: branches/testing_cleanup/scipy/weave/tests/test_size_check.py
===================================================================
--- branches/testing_cleanup/scipy/weave/tests/test_size_check.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/weave/tests/test_size_check.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -2,8 +2,8 @@
from numpy import *
from scipy.testing import *
-from weave import size_check
-from weave.ast_tools import *
+from scipy.weave import size_check
+from scipy.weave.ast_tools import *
import numpy as nx
Modified: branches/testing_cleanup/scipy/weave/tests/test_slice_handler.py
===================================================================
--- branches/testing_cleanup/scipy/weave/tests/test_slice_handler.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/weave/tests/test_slice_handler.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -1,9 +1,9 @@
from scipy.testing import *
-from weave import slice_handler
-from weave.slice_handler import indexed_array_pattern
-from weave.ast_tools import *
+from scipy.weave import slice_handler
+from scipy.weave.slice_handler import indexed_array_pattern
+from scipy.weave.ast_tools import *
def print_assert_equal(test_string,actual,desired):
Modified: branches/testing_cleanup/scipy/weave/tests/test_standard_array_spec.py
===================================================================
--- branches/testing_cleanup/scipy/weave/tests/test_standard_array_spec.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/weave/tests/test_standard_array_spec.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -2,9 +2,8 @@
from numpy import *
from scipy.testing import *
-from weave import standard_array_spec
+from scipy.weave import standard_array_spec
-
def remove_whitespace(in_str):
out = in_str.replace(" ","")
out = out.replace("\t","")
Modified: branches/testing_cleanup/scipy/weave/tests/weave_test_utils.py
===================================================================
--- branches/testing_cleanup/scipy/weave/tests/weave_test_utils.py 2008-01-09 00:53:59 UTC (rev 3806)
+++ branches/testing_cleanup/scipy/weave/tests/weave_test_utils.py 2008-01-09 01:08:07 UTC (rev 3807)
@@ -28,10 +28,7 @@
# mainly used by catalog tests
###################################################
-from numpy.testing import set_package_path, restore_path
-set_package_path()
-from weave import catalog
-restore_path()
+from scipy.weave import catalog
import glob
More information about the Scipy-svn
mailing list