diff options
author | Adam Stokes <adam.stokes@ubuntu.com> | 2013-10-30 22:14:55 -0400 |
---|---|---|
committer | Adam Stokes <adam.stokes@ubuntu.com> | 2013-10-30 22:14:55 -0400 |
commit | cd99ebea74a606fe037580eead2702f4c2dd7c65 (patch) | |
tree | 3ab32f8ed6a19d2dfbfa87d8c55f86bdd0e509a7 /tests/plugin_tests.py | |
parent | c398e45ce3e22062df08c2d4f9dc1eed1ee99e1d (diff) | |
download | sos-cd99ebea74a606fe037580eead2702f4c2dd7c65.tar.gz |
Python 3 port
This includes a necessary dependency on python-six for its compability layer
since we are wanting to continue support for both Python 2.7.x and Python 3.x.
In addition, this will allow us to effectively phase out Python 2 support
when/if the time arises that all interested distributions have done away with
Python 2.
This port passes all unittests for both python 2.7.x and python 3.3.x
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
Diffstat (limited to 'tests/plugin_tests.py')
-rw-r--r-- | tests/plugin_tests.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py index 9f8817d2..c4b540fa 100644 --- a/tests/plugin_tests.py +++ b/tests/plugin_tests.py @@ -1,7 +1,13 @@ import unittest import os import tempfile -from StringIO import StringIO + +# PYCOMPAT +import six +if six.PY2: + from StringIO import StringIO +else: + from io import StringIO from sos.plugins import Plugin, regex_findall, sos_relative_path, mangle_command from sos.archive import TarFileArchive, ZipFileArchive @@ -14,7 +20,7 @@ def j(filename): def create_file(size): f = tempfile.NamedTemporaryFile(delete=False) - f.write("*" * size * 1024 * 1024) + f.write(six.b("*" * size * 1024 * 1024)) f.flush() f.close() return f.name |