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
This commit is contained in:
Matthew Treinish 2016-10-13 15:46:33 -04:00
parent 93e6a03700
commit 219796218a
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 3 additions and 2 deletions

View File

@ -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 @@ class TempestInit(command.Command):
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(