Index: third_party/typ/typ/runner.py |
diff --git a/third_party/typ/typ/runner.py b/third_party/typ/typ/runner.py |
index 38c0e1c554f3d8d3032a281e564da8194feb63e3..c2975f166e96a497741854f17193e08cf935a197 100644 |
--- a/third_party/typ/typ/runner.py |
+++ b/third_party/typ/typ/runner.py |
@@ -353,9 +353,18 @@ class Runner(object): |
# TODO: Add support for discovering setupProcess/teardownProcess? |
- test_set.parallel_tests = _sort_inputs(test_set.parallel_tests) |
- test_set.isolated_tests = _sort_inputs(test_set.isolated_tests) |
- test_set.tests_to_skip = _sort_inputs(test_set.tests_to_skip) |
+ shard_index = args.shard_index |
+ total_shards = args.total_shards |
+ assert total_shards >= 1 |
+ assert shard_index >= 0 and shard_index < total_shards, ( |
+ 'shard_index (%d) must be >= 0 and < total_shards (%d)' % |
+ (shard_index, total_shards)) |
+ test_set.parallel_tests = _sort_inputs( |
+ test_set.parallel_tests)[shard_index::total_shards] |
+ test_set.isolated_tests = _sort_inputs( |
+ test_set.isolated_tests)[shard_index::total_shards] |
+ test_set.tests_to_skip = _sort_inputs( |
+ test_set.tests_to_skip)[shard_index::total_shards] |
return 0, test_set |
finally: |
unittest.skip = orig_skip |
@@ -812,7 +821,7 @@ def _run_one_test(child, test_input): |
tests = list(suite) |
if len(tests) != 1: |
- err = 'Failed to load %s' |
+ err = 'Failed to load %s' % test_name |
if tb_str: # pragma: untested |
err += (' (traceback follows):\n %s' % |
' \n'.join(tb_str.splitlines())) |