diff options
author | 2018-03-13 22:05:48 -0700 | |
---|---|---|
committer | 2018-03-27 19:44:43 -0700 | |
commit | 1bfff8eec05a8892efbe8541143e3f90e96b48e4 (patch) | |
tree | a83689bc1078ee9e26735d4979233c4bf25166f9 /src/python/grpcio_tests/tests | |
parent | 0bb2fe946eee97f33fcf7e0bb6d20fd320bef5d2 (diff) |
Initial gevent support
Because some cpp code ends up leaking into cython, we change
the cython generator to generate cpp code.
Diffstat (limited to 'src/python/grpcio_tests/tests')
-rw-r--r-- | src/python/grpcio_tests/tests/_runner.py | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/src/python/grpcio_tests/tests/_runner.py b/src/python/grpcio_tests/tests/_runner.py index 8e27dc6c6d..eaaa027e61 100644 --- a/src/python/grpcio_tests/tests/_runner.py +++ b/src/python/grpcio_tests/tests/_runner.py @@ -117,6 +117,12 @@ class AugmentedCase(collections.namedtuple('AugmentedCase', ['case', 'id'])): class Runner(object): + def __init__(self): + self._skipped_tests = [] + + def skip_tests(self, tests): + self._skipped_tests = tests + def run(self, suite): """See setuptools' test_runner setup argument for information.""" # only run test cases with id starting with given prefix @@ -181,27 +187,31 @@ class Runner(object): # Run the tests result.startTestRun() for augmented_case in augmented_cases: - sys.stdout.write('Running {}\n'.format( - augmented_case.case.id())) - sys.stdout.flush() - case_thread = threading.Thread( - target=augmented_case.case.run, args=(result,)) - try: - with stdout_pipe, stderr_pipe: - case_thread.start() - while case_thread.is_alive(): - check_kill_self() - time.sleep(0) - case_thread.join() - except: - # re-raise the exception after forcing the with-block to end - raise - result.set_output(augmented_case.case, stdout_pipe.output(), - stderr_pipe.output()) - sys.stdout.write(result_out.getvalue()) - sys.stdout.flush() - result_out.truncate(0) - check_kill_self() + for skipped_test in self._skipped_tests: + if skipped_test in augmented_case.case.id(): + break + else: + sys.stdout.write('Running {}\n'.format( + augmented_case.case.id())) + sys.stdout.flush() + case_thread = threading.Thread( + target=augmented_case.case.run, args=(result,)) + try: + with stdout_pipe, stderr_pipe: + case_thread.start() + while case_thread.is_alive(): + check_kill_self() + time.sleep(0) + case_thread.join() + except: + # re-raise the exception after forcing the with-block to end + raise + result.set_output(augmented_case.case, stdout_pipe.output(), + stderr_pipe.output()) + sys.stdout.write(result_out.getvalue()) + sys.stdout.flush() + result_out.truncate(0) + check_kill_self() result.stopTestRun() stdout_pipe.close() stderr_pipe.close() |