Skip to content

Commit 63fbc36

Browse files
committed
Close sample input file after reading it
Otherwise tests spit out: ResourceWarning: unclosed file <_io.TextIOWrapper name='/Users/pypt/Dropbox/etc-MediaCloud/python-readability/tests/samples/si-game.sample.html' mode='r' encoding='UTF-8'> return open(os.path.join(SAMPLES, filename)).read()
1 parent bdb6d67 commit 63fbc36

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/test_article_only.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
def load_sample(filename):
1111
"""Helper to get the content out of the sample files"""
12-
return open(os.path.join(SAMPLES, filename)).read()
12+
with open(os.path.join(SAMPLES, filename)) as f:
13+
html = f.read()
14+
return html
1315

1416

1517
class TestArticleOnly(unittest.TestCase):

0 commit comments

Comments
 (0)