diff --git a/testing/web-platform/harness/wptrunner/testloader.py b/testing/web-platform/harness/wptrunner/testloader.py index 29a07c455220..baf09bde8acc 100644 --- a/testing/web-platform/harness/wptrunner/testloader.py +++ b/testing/web-platform/harness/wptrunner/testloader.py @@ -1,6 +1,6 @@ +import hashlib import json import os -import sys import urlparse from abc import ABCMeta, abstractmethod from Queue import Empty @@ -43,12 +43,14 @@ class Unchunked(TestChunker): class HashChunker(TestChunker): - def __call__(self): + def __call__(self, manifest): chunk_index = self.chunk_number - 1 for test_path, tests in manifest: - if hash(test_path) % self.total_chunks == chunk_index: + h = int(hashlib.md5(test_path).hexdigest(), 16) + if h % self.total_chunks == chunk_index: yield test_path, tests + class EqualTimeChunker(TestChunker): def _group_by_directory(self, manifest_items): """Split the list of manifest items into a ordered dict that groups tests in