diff options
author | Georg Brandl <georg@python.org> | 2014-10-07 14:10:28 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-10-07 14:10:28 +0200 |
commit | 9a51e6a6df8a56aebede133687e91e519a186122 (patch) | |
tree | ffebef0e0f0b63c2749e2858fdc50972a336fc2b /tests/test_html_formatter.py | |
parent | 9cbc7803dd8e7826393721fe4acbd702843e131c (diff) | |
download | pygments-9a51e6a6df8a56aebede133687e91e519a186122.tar.gz |
Closes #980: fix DeprecationWarnings (mostly due to files closed by __del__) on Py3.
Also fix a bunch of other uses of open() to use the with statement.
Diffstat (limited to 'tests/test_html_formatter.py')
-rw-r--r-- | tests/test_html_formatter.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/test_html_formatter.py b/tests/test_html_formatter.py index 91225cd3..5b1b2576 100644 --- a/tests/test_html_formatter.py +++ b/tests/test_html_formatter.py @@ -25,11 +25,8 @@ import support TESTFILE, TESTDIR = support.location(__file__) -fp = io.open(TESTFILE, encoding='utf-8') -try: +with io.open(TESTFILE, encoding='utf-8') as fp: tokensource = list(PythonLexer().get_tokens(fp.read())) -finally: - fp.close() class HtmlFormatterTest(unittest.TestCase): |