summaryrefslogtreecommitdiff
path: root/morphlib/bins_tests.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-09-23 18:14:08 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-09-24 11:24:36 +0000
commita751e4fc1ab7b00ae70f12f498d2050a5fb71445 (patch)
tree94bd038495f06a46ade459f72face80bf5ff7392 /morphlib/bins_tests.py
parentf9c02205608356b4c57611509b574e3874d243a9 (diff)
downloadmorph-a751e4fc1ab7b00ae70f12f498d2050a5fb71445.tar.gz
Allow Morph code to be run with Python 2.7 and Python 3.4sam/python3
PRETTY BROKEN! Change-Id: I92545c821103eea1316383086e77e6b654f2321c
Diffstat (limited to 'morphlib/bins_tests.py')
-rw-r--r--morphlib/bins_tests.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/morphlib/bins_tests.py b/morphlib/bins_tests.py
index 3895680f..e2bb2f6a 100644
--- a/morphlib/bins_tests.py
+++ b/morphlib/bins_tests.py
@@ -17,13 +17,18 @@ import gzip
import os
import shutil
import stat
+import sys
import tempfile
import tarfile
import unittest
-import StringIO
import morphlib
+if sys.version_info[0] == 2:
+ from StringIO import StringIO
+else:
+ from io import StringIO
+
class BinsTest(unittest.TestCase):
@@ -152,7 +157,7 @@ class ExtractTests(unittest.TestCase):
shutil.rmtree(self.tempdir)
def create_chunk(self, callback):
- fh = StringIO.StringIO()
+ fh = StringIO()
os.mkdir(self.instdir)
patterns = callback(self.instdir)
morphlib.bins.create_chunk(self.instdir, fh, patterns)