diff options
-rw-r--r-- | third_party/typ/README.chromium | 4 | ||||
-rw-r--r-- | third_party/typ/setup.py | 4 | ||||
-rw-r--r-- | third_party/typ/typ/runner.py | 21 | ||||
-rw-r--r-- | third_party/typ/typ/tests/arg_parser_test.py | 2 | ||||
-rw-r--r-- | third_party/typ/typ/tests/runner_test.py | 15 | ||||
-rw-r--r-- | third_party/typ/typ/version.py | 2 |
6 files changed, 34 insertions, 14 deletions
diff --git a/third_party/typ/README.chromium b/third_party/typ/README.chromium index 360a646..b7d6bfc 100644 --- a/third_party/typ/README.chromium +++ b/third_party/typ/README.chromium @@ -1,7 +1,7 @@ Name: typ URL: https://github.com/dpranke/typ.git -Version: 0.8.6 -Revision: e25b780b0b147580ef248c212b238446264d9d78 +Version: 0.8.9 +Revision: 68b64ff805d266c7a249294abc45cc12076aeb9f Security Critical: no License: Apache 2.0 License File: NOT_SHIPPED diff --git a/third_party/typ/setup.py b/third_party/typ/setup.py index 170398f..2c32a68 100644 --- a/third_party/typ/setup.py +++ b/third_party/typ/setup.py @@ -15,7 +15,7 @@ import os import sys -from setuptools import setup +from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) if here not in sys.path: @@ -30,7 +30,7 @@ readme_lines = readme.splitlines() setup( name='typ', - packages=['typ'], + packages=find_packages(), package_data={'': ['../README.rst']}, entry_points={ 'console_scripts': [ diff --git a/third_party/typ/typ/runner.py b/third_party/typ/typ/runner.py index 61aeb9d..9872a60 100644 --- a/third_party/typ/typ/runner.py +++ b/third_party/typ/typ/runner.py @@ -111,6 +111,7 @@ class Runner(object): self.teardown_fn = None self.top_level_dir = None self.win_multiprocessing = WinMultiprocessing.spawn + self.final_responses = [] # initialize self.args to the defaults. parser = ArgumentParser(self.host) @@ -453,9 +454,10 @@ class Runner(object): len(test_set.isolated_tests) + len(test_set.tests_to_skip)) self._skip_tests(stats, result_set, test_set.tests_to_skip) - self._run_list(stats, result_set, test_set.parallel_tests, - self.args.jobs) - self._run_list(stats, result_set, test_set.isolated_tests, 1) + self._run_list(stats, result_set, + test_set.parallel_tests, self.args.jobs) + self._run_list(stats, result_set, + test_set.isolated_tests, 1) def _skip_tests(self, stats, result_set, tests_to_skip): for test_input in tests_to_skip: @@ -498,7 +500,7 @@ class Runner(object): self._print_test_finished(stats, result) pool.close() finally: - pool.join() + self.final_responses.extend(pool.join()) def _print_test_started(self, stats, test_input): if not self.args.quiet and self.args.overwrite: @@ -739,16 +741,19 @@ def _setup_process(host, worker_num, child): def _teardown_process(child): + res = None + e = None if child.teardown_fn: - child.teardown_fn(child, child.context_after_setup) - # TODO: Return a more structured result, including something from - # the teardown function? + try: + res = child.teardown_fn(child, child.context_after_setup) + except Exception as e: + pass if child.cov: # pragma: no cover child.cov.stop() child.cov.save() - return child.worker_num + return (child.worker_num, res, e) def _run_one_test(child, test_input): diff --git a/third_party/typ/typ/tests/arg_parser_test.py b/third_party/typ/typ/tests/arg_parser_test.py index aabaebe..e603ecd 100644 --- a/third_party/typ/typ/tests/arg_parser_test.py +++ b/third_party/typ/typ/tests/arg_parser_test.py @@ -41,5 +41,5 @@ class ArgumentParserTest(unittest.TestCase): check(['--version']) check(['--coverage', '--coverage-omit', 'foo']) - check(['--jobs', '4']) + check(['--jobs', '3']) check(['-vv'], ['--verbose', '--verbose']) diff --git a/third_party/typ/typ/tests/runner_test.py b/third_party/typ/typ/tests/runner_test.py index 1d8e510..e03d611 100644 --- a/third_party/typ/typ/tests/runner_test.py +++ b/third_party/typ/typ/tests/runner_test.py @@ -28,6 +28,9 @@ def _setup_process(child, context): # pylint: disable=W0613 def _teardown_process(child, context): # pylint: disable=W0613 return context +def _teardown_throws(child, context): # pylint: disable=W0613 + raise Exception("exception in teardown") + class RunnerTests(TestCase): def test_context(self): @@ -40,6 +43,18 @@ class RunnerTests(TestCase): ret, _, _ = r.run() self.assertEqual(ret, 0) + def test_exception_in_teardown(self): + r = Runner() + r.args.tests = ['typ.tests.runner_test.ContextTests'] + r.context = {'foo': 'bar'} + r.setup_fn = _setup_process + r.teardown_fn = _teardown_throws + r.win_multiprocessing = WinMultiprocessing.importable + ret, _, _ = r.run() + self.assertEqual(ret, 0) + self.assertEqual(r.final_responses[0][2].message, + 'exception in teardown') + def test_bad_default(self): r = Runner() ret = r.main([], foo='bar') diff --git a/third_party/typ/typ/version.py b/third_party/typ/typ/version.py index 3b66ba0..073f6fe 100644 --- a/third_party/typ/typ/version.py +++ b/third_party/typ/typ/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = '0.8.6' +VERSION = '0.8.9' |