1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-05 18:31:12 +01:00

utils/diff: fix diff_interrupt_files on Python 2

During Python 3 migration, the izip call inside diff_interrupt_files has
been replaced with a zip call (zip returning an iterator in Python 3).
Import zip from builtins to ensure that it also produces an iterator in
Python 2.

Also fix the associated unit test by importing the correct function.
This commit is contained in:
Sergei Trofimov 2018-06-14 12:53:19 +01:00 committed by setrofim
parent d64ab6f099
commit 64f9cf79e4
2 changed files with 3 additions and 2 deletions

View File

@ -22,7 +22,7 @@ from unittest import TestCase
from nose.tools import assert_equal from nose.tools import assert_equal
from wa.instruments.misc import _diff_interrupt_files from wa.utils.diff import diff_interrupt_files
class InterruptDiffTest(TestCase): class InterruptDiffTest(TestCase):
@ -34,7 +34,7 @@ class InterruptDiffTest(TestCase):
expected_result_file = os.path.join(file_dir, 'result') expected_result_file = os.path.join(file_dir, 'result')
output_file = tempfile.mktemp() output_file = tempfile.mktemp()
_diff_interrupt_files(before_file, after_file, output_file) diff_interrupt_files(before_file, after_file, output_file)
with open(output_file) as fh: with open(output_file) as fh:
output_diff = fh.read() output_diff = fh.read()
with open(expected_result_file) as fh: with open(expected_result_file) as fh:

View File

@ -1,6 +1,7 @@
import os import os
import re import re
from builtins import zip
from future.moves.itertools import zip_longest from future.moves.itertools import zip_longest
from wa.utils.misc import as_relative, diff_tokens, write_table from wa.utils.misc import as_relative, diff_tokens, write_table