Set PYTHON env variable for python3
Several .testr.conf files have tests to check for the
PYTHON env variable and fallback to "python". For
several python3 scenarios, we should set the PYTHON
variable so these scenarios actually use python3.
Change-Id: I55335d946dfd031e4501ca465564a933fa487871
diff --git a/tempest/cmd/run.py b/tempest/cmd/run.py
index 5fa8b74..a3105e0 100644
--- a/tempest/cmd/run.py
+++ b/tempest/cmd/run.py
@@ -88,6 +88,7 @@
from cliff import command
from os_testr import regex_builder
from os_testr import subunit_trace
+import six
from testrepository.commands import run_argv
from tempest.cmd import init
@@ -109,6 +110,12 @@
return
else:
os.environ["TESTR_PDB"] = ""
+ # NOTE(dims): most of our .testr.conf try to test for PYTHON
+ # environment variable and fall back to "python", under python3
+ # if it does not exist. we should set it to the python3 executable
+ # to deal with this situation better for now.
+ if six.PY3 and 'PYTHON' not in os.environ:
+ os.environ['PYTHON'] = sys.executable
def _create_testrepository(self):
if not os.path.isdir('.testrepository'):