Skip to content
This repository has been archived by the owner on May 3, 2020. It is now read-only.

Commit

Permalink
Merge 5250553 into d013454
Browse files Browse the repository at this point in the history
  • Loading branch information
jirikuncar committed Jan 27, 2015
2 parents d013454 + 5250553 commit 6d6df39
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ html_coverage_report
# Packages
*.egg
*.egg-info
.eggs
dist
build
eggs
Expand Down
10 changes: 6 additions & 4 deletions invenio_kwalitee/cli/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ def _ensure_directory(filename):
if not os.path.exists(dir_):
os.makedirs(dir_)

def _format_errors(args):
filename, errors = args
return error_template.format(filename=filename, errors='\n'.join(
errors if len(errors) else no_errors))

count = 0
ident = ' '
re_line = re.compile('^', re.MULTILINE)
Expand Down Expand Up @@ -208,10 +213,7 @@ def _ensure_directory(filename):
message = re.sub(re_line, ident, message)
if len(errors):
count += 1
errors = map(lambda (filename, errors): error_template.format(
filename=filename, errors='\n'.join(
errors if len(errors) else no_errors
)), errors.items())
errors = map(_format_errors, errors.items())
else:
errors = no_errors

Expand Down
10 changes: 5 additions & 5 deletions tests/test_pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,15 @@ def test_pull_request_task(app, owner, repository, session):
httpretty.disable()

latest_requests = httpretty.HTTPretty.latest_requests
# 6x GET pull, issue, commits, 2xfiles, spam/eggs.py
# 6x POST comments (2 messages + 2 file), label, status
assert_that(len(latest_requests), equal_to(12), "6x GET + 6x POST")
# 6x GET pull, issue, commits, files, spam/eggs.py, spam/herp.html
# 5x POST comments (1 message + 2 files), status
# 1x PUT labels
assert_that(len(latest_requests), equal_to(11), "6x GET + 4x POST + 1 PUT")

expected_requests = [
"",
"",
"missing component name",
"signature is missing",
"missing component name", # "signature is missing",
"",
"",
"",
Expand Down

0 comments on commit 6d6df39

Please sign in to comment.