[PATCH 06/14] tests: Use io.StringIO instead String.StringIO

Javier Jardón javier.jardon at codethink.co.uk
Tue Jan 22 13:45:30 GMT 2013


---
 morphlib/bins_tests.py                | 5 ++---
 morphlib/remoteartifactcache_tests.py | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/morphlib/bins_tests.py b/morphlib/bins_tests.py
index 3288207..48e57b9 100644
--- a/morphlib/bins_tests.py
+++ b/morphlib/bins_tests.py
@@ -13,14 +13,13 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-
+import io
 import os
 import shutil
 import stat
 import tempfile
 import tarfile
 import unittest
-import StringIO
 
 import morphlib
 
@@ -146,7 +145,7 @@ class ExtractTests(unittest.TestCase):
         shutil.rmtree(self.tempdir)
 
     def create_chunk(self, callback):
-        fh = StringIO.StringIO()
+        fh = io.BytesIO()
         os.mkdir(self.instdir)
         patterns = callback(self.instdir)
         morphlib.bins.create_chunk(self.instdir, fh, patterns)
diff --git a/morphlib/remoteartifactcache_tests.py b/morphlib/remoteartifactcache_tests.py
index 431731b..8d416a5 100644
--- a/morphlib/remoteartifactcache_tests.py
+++ b/morphlib/remoteartifactcache_tests.py
@@ -14,7 +14,7 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 
-import StringIO
+import io
 import unittest
 import urllib2
 
@@ -75,7 +75,7 @@ class RemoteArtifactCacheTests(unittest.TestCase):
 
     def _get_file(self, filename):
         if filename in self.existing_files:
-            return StringIO.StringIO('%s' % filename)
+            return io.StringIO(u'%s' % filename)
         else:
             raise urllib2.URLError('foo')
 
-- 
1.8.1





More information about the baserock-dev mailing list