Skip to content

Commit 5395074

Browse files
authored
TST: close sas read handles properly in tests (pandas-dev#15100)
1 parent 41170d4 commit 5395074

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/io/tests/sas/test_sas7bdat.py

+6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def test_from_buffer(self):
5151
iterator=True, encoding='utf-8')
5252
df = rdr.read()
5353
tm.assert_frame_equal(df, df0, check_exact=False)
54+
rdr.close()
5455

5556
def test_from_iterator(self):
5657
for j in 0, 1:
@@ -62,6 +63,7 @@ def test_from_iterator(self):
6263
tm.assert_frame_equal(df, df0.iloc[0:2, :])
6364
df = rdr.read(3)
6465
tm.assert_frame_equal(df, df0.iloc[2:5, :])
66+
rdr.close()
6567

6668
def test_iterator_loop(self):
6769
# github #13654
@@ -74,6 +76,7 @@ def test_iterator_loop(self):
7476
for x in rdr:
7577
y += x.shape[0]
7678
self.assertTrue(y == rdr.row_count)
79+
rdr.close()
7780

7881
def test_iterator_read_too_much(self):
7982
# github #14734
@@ -82,9 +85,12 @@ def test_iterator_read_too_much(self):
8285
rdr = pd.read_sas(fname, format="sas7bdat",
8386
iterator=True, encoding='utf-8')
8487
d1 = rdr.read(rdr.row_count + 20)
88+
rdr.close()
89+
8590
rdr = pd.read_sas(fname, iterator=True, encoding="utf-8")
8691
d2 = rdr.read(rdr.row_count + 20)
8792
tm.assert_frame_equal(d1, d2)
93+
rdr.close()
8894

8995

9096
def test_encoding_options():

0 commit comments

Comments
 (0)