Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions testbenchexecutor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class TestBenchExecutor(object):
_dict_manifest = dict()
_steps = list()

def __init__(self, manifest_path, detailed=False):
def __init__(self, manifest_path, detailed=False, read_env_vars=False):
"""
@param manifest_path: The path to the test bench manifest
@type manifest_path: str
Expand All @@ -81,6 +81,7 @@ def __init__(self, manifest_path, detailed=False):

self._path_manifest = manifest_path
self._detailed = detailed
self._read_env_vars = read_env_vars
self._load_tb_manifest()
# TODO: command-line option to skip this
with self._update_manifest() as manifest:
Expand Down Expand Up @@ -261,7 +262,8 @@ def _execute_step(self, step):
with open(os.devnull, "r") as null_file:
invocation = step["Invocation"]
if invocation.lower().startswith("python.exe "):
invocation = "\"" + sys.executable + "\" " + step["Invocation"][len("python.exe "):]
ignore_env_vars_opt = "" if self._read_env_vars else "\"-E\" "
invocation = "\"" + sys.executable + "\" " + ignore_env_vars_opt + step["Invocation"][len("python.exe "):]
invocation = parse(invocation)
if os.path.splitext(invocation[0])[1].lower() in ('.cmd', '.bat'):
# special-case, since cmd.exe doesn't directly support UNC paths (e.g. shared folders). Scripts should also include "pushd %~dp0"
Expand Down
5 changes: 4 additions & 1 deletion testbenchexecutor/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ def main():
help='run only the first unexecuted step (default: run all unexecuted steps)')
parser.add_argument('--detailed-errors', '-d', action='store_true',
help='On step failure, output last few lines of log')
parser.add_argument('--read-python-env-variables', action='store_true',
help='Read Python* Environment Variables, e.g. PYTHONPATH and PYTHONHOME')
parser.add_argument('manifest', type=str, nargs=1,
help='the path of the manifest to be executed')

args = parser.parse_args()

executor = TestBenchExecutor(args.manifest[0], detailed=args.detailed_errors)
executor = TestBenchExecutor(args.manifest[0], detailed=args.detailed_errors,
read_env_vars=args.read_python_env_variables)

if args.run_one:
sys.exit(executor.run_next_step())
Expand Down