Skip to content
Snippets Groups Projects
Commit 15c5ffa638c9 authored by Bob Ippolito's avatar Bob Ippolito
Browse files

fix python 2.5 regression in tool and test_tool

parent 6f3aec782117
No related branches found
No related tags found
No related merge requests found
from __future__ import with_statement
import os import os
import sys import sys
import textwrap import textwrap
...@@ -45,7 +46,7 @@ ...@@ -45,7 +46,7 @@
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
out, err = proc.communicate(data) out, err = proc.communicate(data)
self.assertEqual(len(err), 0) self.assertEqual(err, ''.encode())
self.assertEqual(proc.returncode, 0) self.assertEqual(proc.returncode, 0)
return out return out
...@@ -68,7 +69,7 @@ ...@@ -68,7 +69,7 @@
infile.flush() infile.flush()
# outfile will get overwritten by tool, so the delete # outfile will get overwritten by tool, so the delete
# may not work on some platforms. Do it manually. # may not work on some platforms. Do it manually.
outfile = tempfile.NamedTemporaryFile(delete=0) outfile = tempfile.NamedTemporaryFile()
try: try:
self.assertEqual( self.assertEqual(
self.runTool(args=[infile.name, outfile.name]), self.runTool(args=[infile.name, outfile.name]),
...@@ -77,4 +78,5 @@ ...@@ -77,4 +78,5 @@
self.assertEqual(f.read(), self.expect.encode()) self.assertEqual(f.read(), self.expect.encode())
finally: finally:
outfile.close() outfile.close()
if os.path.exists(outfile.name):
os.unlink(outfile.name) os.unlink(outfile.name)
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
Expecting property name: line 1 column 2 (char 2) Expecting property name: line 1 column 2 (char 2)
""" """
from __future__ import with_statement
import sys import sys
import simplejson as json import simplejson as json
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment