зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1428705 - fix manifestparser/test_chunking.py for python3 r=ahal,whimboo
Changes: Fix syntax in the test file to work under python3. Assorted changes to the code style, and eliminating unnecessary warnings. Differential Revision: https://phabricator.services.mozilla.com/D56803 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b5623c74df
Коммит
dc60cf7e90
|
@ -7,7 +7,6 @@ subsuite = mozbase
|
|||
[test_convert_directory.py]
|
||||
[test_filters.py]
|
||||
[test_chunking.py]
|
||||
skip-if = python == 3
|
||||
|
||||
[test_convert_symlinks.py]
|
||||
disabled = https://bugzilla.mozilla.org/show_bug.cgi?id=920938
|
||||
|
|
|
@ -8,9 +8,10 @@ from collections import defaultdict
|
|||
from itertools import chain
|
||||
from unittest import TestCase
|
||||
|
||||
import mozunit
|
||||
from six.moves import range
|
||||
from six import iteritems
|
||||
|
||||
import mozunit
|
||||
from manifestparser.filters import (
|
||||
chunk_by_dir,
|
||||
chunk_by_runtime,
|
||||
|
@ -91,8 +92,8 @@ class ChunkByDir(TestCase):
|
|||
{ <dir>: <num tests> }
|
||||
"""
|
||||
i = 0
|
||||
for d, num in dirs.iteritems():
|
||||
for j in range(num):
|
||||
for d, num in iteritems(dirs):
|
||||
for _ in range(num):
|
||||
i += 1
|
||||
name = 'test%i' % i
|
||||
test = {'name': name,
|
||||
|
@ -119,7 +120,7 @@ class ChunkByDir(TestCase):
|
|||
f = chunk_by_dir(this, total, depth)
|
||||
res.append(list(f(tests, {})))
|
||||
|
||||
lengths = map(num_groups, res)
|
||||
lengths = list(map(num_groups, res))
|
||||
# the chunk with the most dirs should have at most one more
|
||||
# dir than the chunk with the least dirs
|
||||
self.assertLessEqual(max(lengths) - min(lengths), 1)
|
||||
|
@ -182,8 +183,8 @@ class ChunkByRuntime(TestCase):
|
|||
{ <dir>: <num tests> }
|
||||
"""
|
||||
i = 0
|
||||
for d, num in dirs.iteritems():
|
||||
for j in range(num):
|
||||
for d, num in iteritems(dirs):
|
||||
for _ in range(num):
|
||||
i += 1
|
||||
name = 'test%i' % i
|
||||
manifest = os.path.join(d, 'manifest.ini')
|
||||
|
@ -203,10 +204,10 @@ class ChunkByRuntime(TestCase):
|
|||
|
||||
def chunk_by_round_robin(self, tests, total, runtimes):
|
||||
tests_by_manifest = []
|
||||
for manifest, runtime in runtimes.items():
|
||||
for manifest, runtime in iteritems(runtimes):
|
||||
mtests = [t for t in tests if t['manifest_relpath'] == manifest]
|
||||
tests_by_manifest.append((runtime, mtests))
|
||||
tests_by_manifest.sort()
|
||||
tests_by_manifest.sort(key=lambda x: x[0], reverse=False)
|
||||
|
||||
chunks = [[] for i in range(total)]
|
||||
d = 1 # direction
|
||||
|
|
Загрузка…
Ссылка в новой задаче