summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-02-24 09:18:59 +0100
committerGuido Günther <agx@sigxcpu.org>2016-02-24 20:00:48 +0100
commit7e838a0c18f3ad0f574e3bd7c5c4949701264f01 (patch)
tree75494e2477ade0ee3085ad3c86b3c94ecfd97e14
parent1b59d859f2442dd859fa255a50d3d149c5320213 (diff)
The usual 2to3 string encoding madness
-rw-r--r--tests/test_pkg.py14
-rw-r--r--tests/test_systemd.py2
-rw-r--r--whatmaps/pkg.py2
-rw-r--r--whatmaps/systemd.py2
4 files changed, 10 insertions, 10 deletions
diff --git a/tests/test_pkg.py b/tests/test_pkg.py
index 8006b19..b7707b8 100644
--- a/tests/test_pkg.py
+++ b/tests/test_pkg.py
@@ -40,8 +40,8 @@ class TestPkg(unittest.TestCase):
p._list_contents = '/does/not/matter'
PopenMock = mock.return_value
PopenMock.communicate.return_value = [
- '/package/content',
- '/more/package/content',
+ b'/package/content',
+ b'/more/package/content',
]
PopenMock.returncode = 0
result = p._get_contents()
@@ -62,11 +62,11 @@ class TestPkg(unittest.TestCase):
p = Pkg('doesnotmatter')
p._list_contents = '/does/not/matter'
PopenMock = mock.return_value
- PopenMock.communicate.return_value = ['\n'.join([
- '/lib/foo.so.1',
- '/lib/bar.so',
- '/not/a/shared/object',
- '/not/a/shared/object.soeither',
+ PopenMock.communicate.return_value = [b'\n'.join([
+ b'/lib/foo.so.1',
+ b'/lib/bar.so',
+ b'/not/a/shared/object',
+ b'/not/a/shared/object.soeither',
])]
PopenMock.returncode = 0
result = p.shared_objects
diff --git a/tests/test_systemd.py b/tests/test_systemd.py
index 2fbdfdc..f5af3c9 100644
--- a/tests/test_systemd.py
+++ b/tests/test_systemd.py
@@ -47,7 +47,7 @@ class TestSystemd(unittest.TestCase):
CGroup: name=systemd:/system/libvirt-bin.service
├─ 952 /usr/sbin/libvirtd
└─1355 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf
- """
+ """.encode('utf-8')
with patch('os.path.exists', return_value=True):
with patch('subprocess.Popen') as mock:
PopenMock = mock.return_value
diff --git a/whatmaps/pkg.py b/whatmaps/pkg.py
index ab9088d..4290d0b 100644
--- a/whatmaps/pkg.py
+++ b/whatmaps/pkg.py
@@ -63,7 +63,7 @@ class Pkg(object):
output = list_contents.communicate()[0]
if list_contents.returncode:
raise PkgError("Failed to list package contents for '%s'" % self.name)
- self._contents = output.split('\n')
+ self._contents = output.decode('utf-8').split('\n')
return self._contents
@property
diff --git a/whatmaps/systemd.py b/whatmaps/systemd.py
index ef15a26..9bc03b1 100644
--- a/whatmaps/systemd.py
+++ b/whatmaps/systemd.py
@@ -38,7 +38,7 @@ class Systemd(object):
if systemctl_status.returncode:
return None
else:
- parts = output.split()
+ parts = output.decode('utf-8').split()
if parts[0].endswith('.service'):
return parts[0]
elif parts[1].endswith('.service'):