|
|
|
@ -117,7 +117,7 @@ class AugmentedCase(collections.namedtuple('AugmentedCase', ['case', 'id'])): |
|
|
|
|
|
|
|
|
|
class Runner(object): |
|
|
|
|
|
|
|
|
|
def __init__(self, dedicated_threads=True): |
|
|
|
|
def __init__(self, dedicated_threads=False): |
|
|
|
|
"""Constructs the Runner object. |
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
@ -202,11 +202,13 @@ class Runner(object): |
|
|
|
|
augmented_case.case.id())) |
|
|
|
|
sys.stdout.flush() |
|
|
|
|
if self._dedicated_threads: |
|
|
|
|
# (Deprecated) Spawns dedicated thread for each test case. |
|
|
|
|
case_thread = threading.Thread( |
|
|
|
|
target=augmented_case.case.run, args=(result,)) |
|
|
|
|
try: |
|
|
|
|
with stdout_pipe, stderr_pipe: |
|
|
|
|
case_thread.start() |
|
|
|
|
# If the thread is exited unexpected, stop testing. |
|
|
|
|
while case_thread.is_alive(): |
|
|
|
|
check_kill_self() |
|
|
|
|
time.sleep(0) |
|
|
|
@ -214,6 +216,7 @@ class Runner(object): |
|
|
|
|
except: # pylint: disable=try-except-raise |
|
|
|
|
# re-raise the exception after forcing the with-block to end |
|
|
|
|
raise |
|
|
|
|
# Records the result of the test case run. |
|
|
|
|
result.set_output(augmented_case.case, stdout_pipe.output(), |
|
|
|
|
stderr_pipe.output()) |
|
|
|
|
sys.stdout.write(result_out.getvalue()) |
|
|
|
@ -221,6 +224,7 @@ class Runner(object): |
|
|
|
|
result_out.truncate(0) |
|
|
|
|
check_kill_self() |
|
|
|
|
else: |
|
|
|
|
# Donates current thread to test case execution. |
|
|
|
|
augmented_case.case.run(result) |
|
|
|
|
result.stopTestRun() |
|
|
|
|
stdout_pipe.close() |
|
|
|
|