Permalink
Browse files

Update xmlrunner.py for Python 3.1 compat

  • Loading branch information...
1 parent 454db0f commit e8f702eca3e7a57535cf1c6c306a0e89a79f04b0 @rtyler committed Feb 21, 2010
Showing with 5 additions and 4 deletions.
  1. +5 −4 tests/xmlrunner.py
View
@@ -13,11 +13,12 @@
import time
import traceback
import unittest
-from StringIO import StringIO
+try:
+ from io import StringIO
+except ImportError:
+ from StringIO import StringIO
from xml.sax.saxutils import escape
-from StringIO import StringIO
-
class _TestInfo(object):
@@ -171,7 +172,7 @@ def run(self, test):
filename = "TEST-%s.xml" % classname
if self._filename:
filename = self._filename
- stream = file(os.path.join(self._path, filename), "w")
+ stream = open(os.path.join(self._path, filename), "w")
stream.write('<?xml version="1.0" encoding="utf-8"?>\n')
else:
stream = self._stream

0 comments on commit e8f702e

Please sign in to comment.