[h5py] 404/455: Improve tests.require to accept a condition

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag 1.3.0
in repository h5py.

commit d7dfa6878a4f8bbc32fe0ce93a4cb9fb44b12d6f
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Wed Feb 10 06:37:38 2010 +0000

    Improve tests.require to accept a condition
---
 h5py/tests/__init__.py     | 7 ++++++-
 h5py/tests/low/test_h5t.py | 7 ++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/h5py/tests/__init__.py b/h5py/tests/__init__.py
index 86ea954..8fb5e3e 100644
--- a/h5py/tests/__init__.py
+++ b/h5py/tests/__init__.py
@@ -30,9 +30,14 @@ def fixme(desc=""):
         return None
     return wrap
 
-def require(api=None, os=None, unicode=None):
+class _placeholder(object):
+    pass
+
+def require(condition=_placeholder, api=None, os=None, unicode=None):
     """ Decorator to enable/disable tests """
     import sys
+    if condition is not _placeholder and not condition:
+        return None
     def haveunicode():
         import os.path
         try:
diff --git a/h5py/tests/low/test_h5t.py b/h5py/tests/low/test_h5t.py
index 3c49fcd..f7b1274 100644
--- a/h5py/tests/low/test_h5t.py
+++ b/h5py/tests/low/test_h5t.py
@@ -7,6 +7,8 @@
 from h5py import tests
 from h5py import *
 
+import numpy as np
+
 class Base(tests.HTest):
     pass
 
@@ -87,11 +89,10 @@ class TestTypeID(Base):
 
 class TestFloat(Base):
 
+    @tests.require(hasattr(np, 'float128'))
     def test_float_exc(self):
         """ (H5T) Unsupported float size raises TypeError """
-        import numpy
-        if hasattr(numpy, 'float128'):
-            self.assertRaises(TypeError, h5t.py_create, numpy.float128)
+        self.assertRaises(TypeError, h5t.py_create, np.float128)
 
     
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/h5py.git



More information about the debian-science-commits mailing list