Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test_dir, top_dir, group_regex = _parse_testrconf()
elif not os.path.isfile(
'.testr.conf') and not os.path.isfile('.stestr.conf'):
msg = ('No .stestr.conf found, please create one.')
print(msg)
sys.exit(1)
regexes = None
if regex:
regexes = regex.split()
serial = not parallel
if list_tests:
# TODO(mtreinish): remove init call after list command detects and
# autocreates the repository
if not os.path.isdir('.stestr'):
commands.init_command()
return commands.list_command(filters=regexes)
return_code = commands.run_command(filters=regexes, subunit_out=subunit,
concurrency=concur, test_path=test_dir,
top_dir=top_dir,
group_regex=group_regex,
until_failure=until_failure,
serial=serial, pretty_out=pretty,
load_list=load_list,
blacklist_file=blacklist_file,
whitelist_file=whitelist_file,
black_regex=black_regex)
if slowest:
sys.stdout.write("\nSlowest Tests:\n")
commands.slowest_command()
return return_code
def call_subunit_run(test_id, pretty, subunit):
env = copy.deepcopy(os.environ)
cmd_save_results = ['stestr', 'load', '--subunit']
if not os.path.isdir('.stestr'):
commands.init_command()
if pretty:
# Use subunit run module
cmd = ['python', '-m', 'subunit.run', test_id]
ps = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE)
# Save subunit results via testr
pfile = subprocess.Popen(cmd_save_results, env=env,
stdin=ps.stdout, stdout=subprocess.PIPE)
ps.stdout.close()
# Transform output via subunit-trace
proc = subprocess.Popen(['subunit-trace', '--no-failure-debug', '-f'],
env=env, stdin=pfile.stdout)
pfile.stdout.close()
proc.communicate()
return proc.returncode
elif subunit: