From c4156cfbe9c22ab99473346b7757d2b54b46baa3 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sat, 19 Dec 2015 15:36:58 -0700 Subject: MAINT: Use temppath in test_not_closing_opened_fid. The test is in numpy/lib/tests/test_io.py. This commit is intended as a demonstration of using temppath. --- numpy/testing/tests/test_utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'numpy/testing/tests') diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index b558270b3..23bd491bc 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -788,11 +788,13 @@ def test_tempdir(): pass assert_(not os.path.isdir(tdir)) + raised = False try: with tempdir() as tdir: raise ValueError() except ValueError: - pass + raised = True + assert_(raised) assert_(not os.path.isdir(tdir)) @@ -803,11 +805,13 @@ def test_temppath(): pass assert_(not os.path.isfile(fpath)) + raised = False try: with temppath() as fpath: raise ValueError() except ValueError: - pass + raised = True + assert_(raised) assert_(not os.path.isfile(fpath)) -- cgit v1.2.1