[master 3/3] Convert bytes value to str.

mulkieran installerbot-noreply at redhat.com
Wed May 27 20:03:10 UTC 2015


From: mulhern <amulhern at redhat.com>

Related: #131

In Python 3, communicate() returns a bytes value.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 tests/loopbackedtestcase.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/loopbackedtestcase.py b/tests/loopbackedtestcase.py
index 9451ed1..bdc0b77 100644
--- a/tests/loopbackedtestcase.py
+++ b/tests/loopbackedtestcase.py
@@ -47,6 +47,12 @@ def removeLoopDev(device_name, file_name):
     os.unlink(file_name)
 
 def getFreeLoopDev():
+    """ Get the name of the free loop device that losetup reports.
+
+        :returns: the name of the free loop device
+        :rtype: str
+        :raises OSError: on failure
+    """
     # There's a race condition here where another process could grab the loop
     # device losetup gives us before we have time to set it up, but that's just
     # a chance we'll have to take.
@@ -64,7 +70,7 @@ def getFreeLoopDev():
     if rc:
         raise OSError("losetup failed to find a free device")
 
-    return out
+    return out.decode("utf-8")
 
 @unittest.skipUnless(os.geteuid() == 0, "requires root privileges")
 class LoopBackedTestCase(unittest.TestCase):


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/ff97a4fe650e10b1d53af117bd207d227ead7069


More information about the anaconda-patches mailing list