summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Haley <bhaley@redhat.com>2018-04-03 11:42:14 -0400
committerBrian Haley <bhaley@redhat.com>2018-04-04 11:40:23 -0400
commitcfc7838f8c6c7276d382457bccc81a47ab97c00a (patch)
tree1fd92c21f37fadf0ed740176da2359d313ca4f5e
parentfbc837e75a6cbc58176b2908699d278d201b1bec (diff)
downloadoslo-rootwrap-cfc7838f8c6c7276d382457bccc81a47ab97c00a.tar.gz
Update to support running benchmark on python3
Fixed a TypeError when running with python3, and also added a 'benchmark3' target to run it on python3 explicitly. Change-Id: Ia3514465f7d1e97845891cf9aaabcf93e36e0f57
-rw-r--r--benchmark/benchmark.py4
-rw-r--r--tox.ini4
2 files changed, 8 insertions, 0 deletions
diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py
index ef7417c..2009eda 100644
--- a/benchmark/benchmark.py
+++ b/benchmark/benchmark.py
@@ -18,6 +18,7 @@ from __future__ import print_function
import atexit
import math
import os
+import six
import subprocess
import sys
import timeit
@@ -34,6 +35,9 @@ def run_plain(cmd):
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = obj.communicate()
+ if six.PY3:
+ out = os.fsdecode(out)
+ err = os.fsdecode(err)
return obj.returncode, out, err
diff --git a/tox.ini b/tox.ini
index 635a185..b411fe1 100644
--- a/tox.ini
+++ b/tox.ini
@@ -44,6 +44,10 @@ exclude = .tox,dist,doc,*.egg,build
[testenv:benchmark]
commands = python benchmark/benchmark.py
+[testenv:benchmark3]
+basepython = python3
+commands = python3 benchmark/benchmark.py
+
[testenv:pip-missing-reqs]
# do not install test-requirements as that will pollute the virtualenv for
# determining missing packages