summaryrefslogtreecommitdiff
path: root/src/lxml/html
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2014-02-19 19:35:03 +0100
committerStefan Behnel <stefan_ml@behnel.de>2014-02-19 19:35:03 +0100
commit7773b066d1e6c427e5c42aba9ce13d9dac9d503b (patch)
treea6e6ab3158f9d6ff61d803cd2b3a295bd1ee772d /src/lxml/html
parent62c9448e09e6590647fded2a80a1d8a2598f5d1d (diff)
downloadpython-lxml-7773b066d1e6c427e5c42aba9ce13d9dac9d503b.tar.gz
clean up test changes
Diffstat (limited to 'src/lxml/html')
-rw-r--r--src/lxml/html/tests/test_html5parser.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/lxml/html/tests/test_html5parser.py b/src/lxml/html/tests/test_html5parser.py
index 53a4f523..e1b5707c 100644
--- a/src/lxml/html/tests/test_html5parser.py
+++ b/src/lxml/html/tests/test_html5parser.py
@@ -289,8 +289,10 @@ class Test_parse(unittest.TestCase):
tmpfile.seek(0)
return tmpfile
except Exception:
- tmpfile.close()
- os.unlink(tempfile.name)
+ try:
+ tmpfile.close()
+ finally:
+ os.unlink(tempfile.name)
raise
def test_with_file_object(self):
@@ -305,8 +307,10 @@ class Test_parse(unittest.TestCase):
def test_with_file_name(self):
parser = DummyParser(doc='the doc')
tmpfile = self.make_temp_file('data')
- data = tmpfile.read()
- tmpfile.close()
+ try:
+ data = tmpfile.read()
+ finally:
+ tmpfile.close()
try:
self.assertEqual(self.call_it(tmpfile.name, parser=parser), 'the doc')
fp, = parser.parse_args
@@ -316,14 +320,15 @@ class Test_parse(unittest.TestCase):
fp.close()
finally:
os.unlink(tmpfile.name)
- # tmpfile.close()
def test_with_url(self):
parser = DummyParser(doc='the doc')
tmpfile = self.make_temp_file('content')
- data = tmpfile.read()
- tmpfile.close()
+ try:
+ data = tmpfile.read()
+ finally:
+ tmpfile.close()
try:
url = path2url(tmpfile.name)
self.assertEqual(self.call_it(url, parser=parser), 'the doc')
@@ -334,7 +339,6 @@ class Test_parse(unittest.TestCase):
fp.close()
finally:
os.unlink(tmpfile.name)
- # tmpfile.close()
@skipUnless(html5lib, 'html5lib is not installed')
def test_integration(self):