[Scipy-svn] r3810 - in branches/testing_cleanup/scipy: linsolve/umfpack/tests stats stats/tests testing

scipy-svn@scip... scipy-svn@scip...
Wed Jan 9 14:55:57 CST 2008


Author: matthew.brett@gmail.com
Date: 2008-01-09 14:55:47 -0600 (Wed, 09 Jan 2008)
New Revision: 3810

Modified:
   branches/testing_cleanup/scipy/linsolve/umfpack/tests/test_umfpack.py
   branches/testing_cleanup/scipy/stats/info.py
   branches/testing_cleanup/scipy/stats/morestats.py
   branches/testing_cleanup/scipy/stats/tests/test_morestats.py
   branches/testing_cleanup/scipy/testing/decorators.py
   branches/testing_cleanup/scipy/testing/nosetester.py
Log:
Fine tuning of test selection

Modified: branches/testing_cleanup/scipy/linsolve/umfpack/tests/test_umfpack.py
===================================================================
--- branches/testing_cleanup/scipy/linsolve/umfpack/tests/test_umfpack.py	2008-01-09 06:42:31 UTC (rev 3809)
+++ branches/testing_cleanup/scipy/linsolve/umfpack/tests/test_umfpack.py	2008-01-09 20:55:47 UTC (rev 3810)
@@ -16,11 +16,14 @@
 import numpy as nm
 import scipy.linsolve.umfpack as um
 
+# Allow disabling of nose tests if umfpack not present
+have_umfpack = um.umfpack._um is not None
 
-
 class TestSolvers(TestCase):
     """Tests inverting a sparse linear system"""
 
+    __test__ = have_umfpack
+    
     def test_solve_complex_without_umfpack(self):
         """Solve: single precision complex"""
         linsolve.use_solver( useUmfpack = False )
@@ -107,6 +110,8 @@
 class TestFactorization(TestCase):
     """Tests factorizing a sparse linear system"""
 
+    __test__ = have_umfpack
+
     def test_complex_lu(self):
         """Getting factors of complex matrix"""
         umfpack = um.UmfpackContext("zi")

Modified: branches/testing_cleanup/scipy/stats/info.py
===================================================================
--- branches/testing_cleanup/scipy/stats/info.py	2008-01-09 06:42:31 UTC (rev 3809)
+++ branches/testing_cleanup/scipy/stats/info.py	2008-01-09 20:55:47 UTC (rev 3810)
@@ -198,7 +198,7 @@
 levene    -- _
 shapiro    -- _
 anderson    -- _
-binom_p    -- _
+binom_test    -- _
 fligner    -- _
 mood    -- _
 oneway    -- _

Modified: branches/testing_cleanup/scipy/stats/morestats.py
===================================================================
--- branches/testing_cleanup/scipy/stats/morestats.py	2008-01-09 06:42:31 UTC (rev 3809)
+++ branches/testing_cleanup/scipy/stats/morestats.py	2008-01-09 20:55:47 UTC (rev 3810)
@@ -17,11 +17,12 @@
 import scipy.special as special
 import futil
 import numpy as sb
+from scipy.testing.decorators import not_a_test
 
 __all__ = ['find_repeats',
            'bayes_mvs', 'kstat', 'kstatvar', 'probplot', 'ppcc_max', 'ppcc_plot',
            'boxcox_llf', 'boxcox', 'boxcox_normmax', 'boxcox_normplot',
-           'shapiro', 'anderson', 'ansari', 'bartlett', 'levene', 'binom_p',
+           'shapiro', 'anderson', 'ansari', 'bartlett', 'levene', 'binom_test',
            'fligner', 'mood', 'oneway', 'wilcoxon',
            'pdf_moments', 'pdf_fromgamma', 'pdfapprox',
            'circmean', 'circvar', 'circstd',
@@ -769,7 +770,8 @@
     pval = distributions.f.sf(W,k-1,Ntot-k) # 1 - cdf
     return W, pval
 
-def binom_p(x,n=None,p=0.5):
+@not_a_test
+def binom_test(x,n=None,p=0.5):
     """An exact (two-sided) test of the null hypothesis that the
     probability of success in a Bernoulli experiment is p.
 

Modified: branches/testing_cleanup/scipy/stats/tests/test_morestats.py
===================================================================
--- branches/testing_cleanup/scipy/stats/tests/test_morestats.py	2008-01-09 06:42:31 UTC (rev 3809)
+++ branches/testing_cleanup/scipy/stats/tests/test_morestats.py	2008-01-09 20:55:47 UTC (rev 3810)
@@ -96,11 +96,11 @@
 
 class TestBinomP(TestCase):
     def test_data(self):
-        pval = stats.binom_p(100,250)
+        pval = stats.binom_test(100,250)
         assert_almost_equal(pval,0.0018833009350757682,11)
-        pval = stats.binom_p(201,405)
+        pval = stats.binom_test(201,405)
         assert_almost_equal(pval,0.92085205962670713,11)
-        pval = stats.binom_p([682,243],p=3.0/4)
+        pval = stats.binom_test([682,243],p=3.0/4)
         assert_almost_equal(pval,0.38249155957481695,11)
 
 class TestFindRepeats(TestCase):

Modified: branches/testing_cleanup/scipy/testing/decorators.py
===================================================================
--- branches/testing_cleanup/scipy/testing/decorators.py	2008-01-09 06:42:31 UTC (rev 3809)
+++ branches/testing_cleanup/scipy/testing/decorators.py	2008-01-09 20:55:47 UTC (rev 3810)
@@ -25,5 +25,10 @@
 
     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
+
+def not_a_test(t):
+    ''' Signals to nose that this function is not a test
+    '''
+    t.__test__ = False
+    return t

Modified: branches/testing_cleanup/scipy/testing/nosetester.py
===================================================================
--- branches/testing_cleanup/scipy/testing/nosetester.py	2008-01-09 06:42:31 UTC (rev 3809)
+++ branches/testing_cleanup/scipy/testing/nosetester.py	2008-01-09 20:55:47 UTC (rev 3810)
@@ -9,7 +9,7 @@
 
     Usage: NoseTester(<package path>).test()
 
-    <package> is package path - None finds calling module path
+    <package path> is package path - None finds calling module path
     """
     def __init__(self, package_path=None):
         if package_path is None:
@@ -50,4 +50,5 @@
         if extra_argv:
             argv+= extra_argv
         nose.run(argv=argv)
+
         



More information about the Scipy-svn mailing list