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()
pull/106/head
Linas Valiukas 6 years ago
parent bdb6d671d8
commit 63fbc36cb8

@ -9,7 +9,9 @@ SAMPLES = os.path.join(os.path.dirname(__file__), 'samples')
def load_sample(filename):
"""Helper to get the content out of the sample files"""
return open(os.path.join(SAMPLES, filename)).read()
with open(os.path.join(SAMPLES, filename)) as f:
html = f.read()
return html
class TestArticleOnly(unittest.TestCase):

Loading…
Cancel
Save