[h5py] 330/455: Fix warnings test for 2.5

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:47 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 bb076863bbd67e4be3f128a736bb47ef59b03fcb
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Sat Nov 28 04:41:09 2009 +0000

    Fix warnings test for 2.5
---
 h5py/tests/common.py     | 11 +++++++++++
 h5py/tests/test_group.py |  6 +++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/h5py/tests/common.py b/h5py/tests/common.py
index ca6e431..42483b3 100644
--- a/h5py/tests/common.py
+++ b/h5py/tests/common.py
@@ -22,6 +22,17 @@ import numpy as np
 
 DATADIR = op.join(op.dirname(h5py.__file__), 'tests/data')
 
+
+import warnings
+from contextlib import contextmanager
+
+ at contextmanager
+def dump_warnings():
+    filters = warnings.filters
+    warnings.simplefilter("ignore")
+    yield
+    warnings.filters = filters
+    
 class ResourceManager(object):
 
     """
diff --git a/h5py/tests/test_group.py b/h5py/tests/test_group.py
index 85fe933..20e6a68 100644
--- a/h5py/tests/test_group.py
+++ b/h5py/tests/test_group.py
@@ -6,8 +6,9 @@ from __future__ import with_statement
 import numpy as np
 
 import h5py
-import warnings
+
 from common import TestCasePlus, api_16, api_18, res
+from common import dump_warnings
 
 SHAPES = [(), (1,), (10,5), (1,10), (10,1), (100,1,100), (51,2,1025)]
 
@@ -81,8 +82,7 @@ class TestSpecial(GroupBase):
     def test_dictcompat(self):
 
         # Old style -- now deprecated
-        with warnings.catch_warnings():
-            warnings.simplefilter("ignore")
+        with dump_warnings():
             self.assert_equal_contents(self.f.listnames(), self.subgroups)
             self.assert_equal_contents(self.f.listobjects(), [self.f[x] for x in self.subgroups])
             self.assert_equal_contents(self.f.listitems(), [(x, self.f[x]) for x in self.subgroups])

-- 
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