From 92de4993be033b0ca9a83cb0c4a79856eaed5bf0 Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Tue, 10 Jan 2017 13:05:36 -0500 Subject: [PATCH] TST: close sas read handles properly in tests --- pandas/io/tests/sas/test_sas7bdat.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandas/io/tests/sas/test_sas7bdat.py b/pandas/io/tests/sas/test_sas7bdat.py index e20ea48247119..69073a90e9669 100644 --- a/pandas/io/tests/sas/test_sas7bdat.py +++ b/pandas/io/tests/sas/test_sas7bdat.py @@ -51,6 +51,7 @@ def test_from_buffer(self): iterator=True, encoding='utf-8') df = rdr.read() tm.assert_frame_equal(df, df0, check_exact=False) + rdr.close() def test_from_iterator(self): for j in 0, 1: @@ -62,6 +63,7 @@ def test_from_iterator(self): tm.assert_frame_equal(df, df0.iloc[0:2, :]) df = rdr.read(3) tm.assert_frame_equal(df, df0.iloc[2:5, :]) + rdr.close() def test_iterator_loop(self): # github #13654 @@ -74,6 +76,7 @@ def test_iterator_loop(self): for x in rdr: y += x.shape[0] self.assertTrue(y == rdr.row_count) + rdr.close() def test_iterator_read_too_much(self): # github #14734 @@ -82,9 +85,12 @@ def test_iterator_read_too_much(self): rdr = pd.read_sas(fname, format="sas7bdat", iterator=True, encoding='utf-8') d1 = rdr.read(rdr.row_count + 20) + rdr.close() + rdr = pd.read_sas(fname, iterator=True, encoding="utf-8") d2 = rdr.read(rdr.row_count + 20) tm.assert_frame_equal(d1, d2) + rdr.close() def test_encoding_options():