|
|
|
@ -117,8 +117,15 @@ class AugmentedCase(collections.namedtuple('AugmentedCase', ['case', 'id'])): |
|
|
|
|
|
|
|
|
|
class Runner(object): |
|
|
|
|
|
|
|
|
|
def __init__(self): |
|
|
|
|
def __init__(self, dedicated_threads=True): |
|
|
|
|
"""Constructs the Runner object. |
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
|
dedicated_threads: A bool indicates whether to spawn each unit test |
|
|
|
|
in separate thread or not. |
|
|
|
|
""" |
|
|
|
|
self._skipped_tests = [] |
|
|
|
|
self._dedicated_threads = dedicated_threads |
|
|
|
|
|
|
|
|
|
def skip_tests(self, tests): |
|
|
|
|
self._skipped_tests = tests |
|
|
|
@ -194,6 +201,7 @@ class Runner(object): |
|
|
|
|
sys.stdout.write('Running {}\n'.format( |
|
|
|
|
augmented_case.case.id())) |
|
|
|
|
sys.stdout.flush() |
|
|
|
|
if self._dedicated_threads: |
|
|
|
|
case_thread = threading.Thread( |
|
|
|
|
target=augmented_case.case.run, args=(result,)) |
|
|
|
|
try: |
|
|
|
@ -212,6 +220,8 @@ class Runner(object): |
|
|
|
|
sys.stdout.flush() |
|
|
|
|
result_out.truncate(0) |
|
|
|
|
check_kill_self() |
|
|
|
|
else: |
|
|
|
|
augmented_case.case.run(result) |
|
|
|
|
result.stopTestRun() |
|
|
|
|
stdout_pipe.close() |
|
|
|
|
stderr_pipe.close() |
|
|
|
@ -223,3 +233,4 @@ class Runner(object): |
|
|
|
|
with open('report.xml', 'wb') as report_xml_file: |
|
|
|
|
_result.jenkins_junit_xml(result).write(report_xml_file) |
|
|
|
|
return result |
|
|
|
|
|
|
|
|
|