summaryrefslogtreecommitdiff
path: root/tests/test_examplefiles.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2012-03-11 08:17:52 +0100
committerGeorg Brandl <georg@python.org>2012-03-11 08:17:52 +0100
commit6f8e79cdf72575dac0047deaf7b2a32540676198 (patch)
treee0ced08a2f775d7e8c9fc4d523566bc797fbcb43 /tests/test_examplefiles.py
parent9e80de2655ac91392e77fdb851cb8af940cff89d (diff)
downloadpygments-6f8e79cdf72575dac0047deaf7b2a32540676198.tar.gz
Fixes #748: clean up deprecation and resource warnings in the test suite when run with python3 -Wd.
Diffstat (limited to 'tests/test_examplefiles.py')
-rw-r--r--tests/test_examplefiles.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test_examplefiles.py b/tests/test_examplefiles.py
index 4ab2912e..41acf4ef 100644
--- a/tests/test_examplefiles.py
+++ b/tests/test_examplefiles.py
@@ -49,7 +49,11 @@ def test_example_files():
yield check_lexer, lx, absfn, outfn
def check_lexer(lx, absfn, outfn):
- text = open(absfn, 'rb').read()
+ fp = open(absfn, 'rb')
+ try:
+ text = fp.read()
+ finally:
+ fp.close()
text = text.replace(b('\r\n'), b('\n'))
text = text.strip(b('\n')) + b('\n')
try: