Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
summary.stopTestRun()
if not results.wasSuccessful(summary):
result = 1
if result:
return result
if pdb:
ids = pdb
if '::' in ids:
ids = ids.replace('::', '.')
if ids.find('/') != -1:
root = ids.replace('.py', '')
ids = root.replace('/', '.')
runner = subunit_run.SubunitTestRunner
stream = io.BytesIO()
program.TestProgram(module=None, argv=['stestr', ids],
testRunner=functools.partial(runner,
stdout=stream))
stream.seek(0)
run_proc = [('subunit', stream)]
return load.load(in_streams=run_proc,
subunit_out=subunit_out,
repo_type=repo_type,
repo_url=repo_url, run_id=combine_id,
pretty_out=pretty_out,
color=color, stdout=stdout, abbreviate=abbreviate,
suppress_attachments=suppress_attachments,
all_attachments=all_attachments)
if failing or analyze_isolation:
ids = _find_failing(repo)
else:
def _getParentArgParser(self):
parser = super(TestProgram, self)._getParentArgParser()
# XXX: Local edit (see http://bugs.python.org/issue22860)
parser.add_argument(
'-l', '--list', dest='listtests', default=False,
action='store_true', help='List tests rather than executing them')
parser.add_argument(
'--load-list', dest='load_list', default=None,
help='Specifies a file containing test ids, only tests matching '
'those ids are executed')
return parser
def main():
runner = SubunitTestRunner
program.TestProgram(
module=None, argv=sys.argv,
testRunner=partial(runner, stdout=sys.stdout))
# you'll be fighting random Bad file desciptor errors
subunit_pipe = os.fdopen(os.dup(subunit_pipe.fileno()), 'wb')
if job_queue.empty():
subunit_pipe.close()
return
try:
test_id = job_queue.get(block=False)
except Exception:
subunit_pipe.close()
return
if not test_id:
os.close(subunit_pipe.fileno())
raise ValueError('Invalid blank test_id: %s' % test_id)
cmd_list = [self.cmd, test_id]
test_runner = run.SubunitTestRunner
program.TestProgram(
module=None, argv=cmd_list,
testRunner=functools.partial(test_runner, stdout=subunit_pipe))