The conversion of bytes to string was being done
piecemeal within the functional tests.  Consolidate
these conversions all into one location within the
run() method.

Signed-off-by: Tom Hromatka <tom.hroma...@oracle.com>
---
 ftests/cgroup.py    | 4 ++--
 ftests/container.py | 2 +-
 ftests/process.py   | 6 +++---
 ftests/run.py       | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ftests/cgroup.py b/ftests/cgroup.py
index f8346e8845df..6286547fe7fd 100644
--- a/ftests/cgroup.py
+++ b/ftests/cgroup.py
@@ -236,7 +236,7 @@ class Cgroup(object):
         if config.args.container:
             ret = config.container.run(cmd)
         else:
-            ret = Run.run(cmd).decode('ascii')
+            ret = Run.run(cmd)
 
         return ret
 
@@ -372,7 +372,7 @@ class Cgroup(object):
         if config.args.container:
             res = config.container.run(cmd)
         else:
-            res = Run.run(cmd).decode('ascii')
+            res = Run.run(cmd)
 
         # convert the cgsnapshot stdout to a dict of cgroup objects
         return Cgroup.snapshot_to_dict(res)
diff --git a/ftests/container.py b/ftests/container.py
index 977f711132b4..0f08e384ea4c 100644
--- a/ftests/container.py
+++ b/ftests/container.py
@@ -148,7 +148,7 @@ class Container(object):
         else:
             raise ContainerError('Unsupported command type')
 
-        return Run.run(cmd, shell_bool=shell_bool).decode('ascii')
+        return Run.run(cmd, shell_bool=shell_bool)
 
     def start(self):
         cmd = list()
diff --git a/ftests/process.py b/ftests/process.py
index 1c411954e1c0..c4ebf8bdbcdb 100644
--- a/ftests/process.py
+++ b/ftests/process.py
@@ -71,7 +71,7 @@ class Process(object):
         if config.args.container:
             pid = config.container.run(cmd, shell_bool=True)
         else:
-            pid = Run.run(cmd, shell_bool=True).decode('ascii')
+            pid = Run.run(cmd, shell_bool=True)
 
             for _pid in pid.splitlines():
                 self.children_pids.append(_pid)
@@ -117,7 +117,7 @@ class Process(object):
         if config.args.container:
             ret = config.container.run(cmd)
         else:
-            ret = Run.run(cmd).decode('ascii')
+            ret = Run.run(cmd)
 
         for line in ret.splitlines():
             # cgroup v1 appears in /proc/{pid}/cgroup like the following:
@@ -157,7 +157,7 @@ class Process(object):
         if config.args.container:
             ret = config.container.run(cmd)
         else:
-            ret = Run.run(cmd).decode('ascii')
+            ret = Run.run(cmd)
 
         for line in ret.splitlines():
             # cgroup v2 appears in /proc/{pid}/cgroup like the following:
diff --git a/ftests/run.py b/ftests/run.py
index 419f38fce781..53b4f34c257d 100644
--- a/ftests/run.py
+++ b/ftests/run.py
@@ -41,8 +41,8 @@ class Run(object):
         out, err = subproc.communicate()
         ret = subproc.returncode
 
-        out = out.strip()
-        err = err.strip()
+        out = out.strip().decode('ascii')
+        err = err.strip().decode('ascii')
 
         if shell_bool:
             Log.log_debug(
-- 
2.26.2



_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to