Skip to content

Commit

Permalink
Make lint.lint work in python 3. (#113)
Browse files Browse the repository at this point in the history
r=gsnedders
  • Loading branch information
Ms2ger authored and gsnedders committed Sep 14, 2016
1 parent 0baebf4 commit 4df423c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lint/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -408,15 +408,15 @@ 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

if not output_json:
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]
Expand Down
6 changes: 0 additions & 6 deletions lint/tests/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 4df423c

Please sign in to comment.