Stop using subprocess for testr init in tempest init
This commit switches the call to testr init from using subprocess to
testr's python run_argv interface. (which is essentially just calling
it via subprocess) The issue with using subprocess directly is that it
assumes testr is in the PATH you're running from. But, in the case of
using a venv this isn't always the case.
Change-Id: I2bab70b0e9fb2ccdc340f48d95340ff7ccdc1364
Closes-Bug: #1633182
diff --git a/tempest/cmd/init.py b/tempest/cmd/init.py
index baa36a2..99185d2 100644
--- a/tempest/cmd/init.py
+++ b/tempest/cmd/init.py
@@ -14,13 +14,13 @@
import os
import shutil
-import subprocess
import sys
from cliff import command
from oslo_config import generator
from oslo_log import log as logging
from six import moves
+from testrepository import commands
from tempest.cmd import workspace
@@ -167,7 +167,8 @@
self.generate_testr_conf(local_dir)
# setup local testr working dir
if not os.path.isdir(testr_dir):
- subprocess.call(['testr', 'init'], cwd=local_dir)
+ commands.run_argv(['testr', 'init', '-d', local_dir], sys.stdin,
+ sys.stdout, sys.stderr)
def take_action(self, parsed_args):
workspace_manager = workspace.WorkspaceManager(