diff --git a/lint/lint.py b/lint/lint.py index 200e446af0dcff..48e667acfce7a0 100644 --- a/lint/lint.py +++ b/lint/lint.py @@ -15,7 +15,7 @@ from .. import localpaths from manifest.sourcefile import SourceFile -from six import iteritems +from six import iteritems, itervalues from six.moves import range here = os.path.abspath(os.path.split(__file__)[0]) @@ -408,7 +408,7 @@ def process_errors(path, errors): last = process_errors(path, errors) or last if not os.path.isdir(abs_path): - with open(abs_path) as f: + with open(abs_path, 'rb') as f: errors = check_file_contents(repo_root, path, f) last = process_errors(path, errors) or last @@ -416,7 +416,7 @@ def process_errors(path, errors): output_error_count(error_count) if error_count: print(ERROR_MSG % (last[0], last[1], last[0], last[1])) - return sum(error_count.itervalues()) + return sum(itervalues(error_count)) path_lints = [check_path_length] file_lints = [check_regexp_line, check_parsed, check_python_ast] diff --git a/lint/tests/test_lint.py b/lint/tests/test_lint.py index 81475aa7df34df..ebca206c816140 100644 --- a/lint/tests/test_lint.py +++ b/lint/tests/test_lint.py @@ -65,7 +65,6 @@ def test_parse_whitelist(): assert ignored == expected_ignored -@pytest.mark.skipif(six.PY3, reason="lint.lint doesn't support Python 3") def test_lint_no_files(capsys): rv = lint(_dummy_repo, [], False) assert rv == 0 @@ -74,7 +73,6 @@ def test_lint_no_files(capsys): assert err == "" -@pytest.mark.skipif(six.PY3, reason="lint.lint doesn't support Python 3") def test_lint_ignored_file(capsys): with _mock_lint("check_path") as mocked_check_path: with _mock_lint("check_file_contents") as mocked_check_file_contents: @@ -87,7 +85,6 @@ def test_lint_ignored_file(capsys): assert err == "" -@pytest.mark.skipif(six.PY3, reason="lint.lint doesn't support Python 3") def test_lint_not_existing_file(capsys): with _mock_lint("check_path") as mocked_check_path: with _mock_lint("check_file_contents") as mocked_check_file_contents: @@ -102,7 +99,6 @@ def test_lint_not_existing_file(capsys): assert err == "" -@pytest.mark.skipif(six.PY3, reason="lint.lint doesn't support Python 3") def test_lint_passing(capsys): with _mock_lint("check_path") as mocked_check_path: with _mock_lint("check_file_contents") as mocked_check_file_contents: @@ -115,7 +111,6 @@ def test_lint_passing(capsys): assert err == "" -@pytest.mark.skipif(six.PY3, reason="lint.lint doesn't support Python 3") def test_lint_failing(capsys): with _mock_lint("check_path") as mocked_check_path: with _mock_lint("check_file_contents") as mocked_check_file_contents: @@ -129,7 +124,6 @@ def test_lint_failing(capsys): assert err == "" -@pytest.mark.skipif(six.PY3, reason="lint.lint doesn't support Python 3") def test_lint_passing_and_failing(capsys): with _mock_lint("check_path") as mocked_check_path: with _mock_lint("check_file_contents") as mocked_check_file_contents: