Skip to content

Commit

Permalink
Fixed bug when extraction warning are displayed.
Browse files Browse the repository at this point in the history
  • Loading branch information
pombredanne committed Jul 13, 2015
1 parent 63f631d commit b8e0a8f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scancode/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def extract_with_progress(input, verbose=False):
click.secho('Extracting: ' + xev.source + ': ', nl=False, fg='green')
else:
if xev.warnings or xev.errors:
click.secho('done.', fg='red')
click.secho('done.', fg='red' if xev.errors else 'yellow')
display_extract_event(xev)
else:
click.secho('done.', fg='green')
Expand All @@ -334,5 +334,5 @@ def extract_with_progress(input, verbose=False):
def display_extract_event(xev):
for e in xev.errors:
click.secho(' ERROR: ' + e, fg='red')
for warn in xev.warnings.values():
for warn in xev.warnings:
click.secho(' WARNING: ' + warn, fg='yellow')
Binary file added tests/scancode/data/extract/broken.tar.gz
Binary file not shown.
Binary file added tests/scancode/data/extract/tarred_gzipped.tgz
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/scancode/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def test_extract_option_does_extract(self):
result = runner.invoke(cli.scancode, ['--extract', test_dir])
assert result.exit_code == 0
assert 'Extracting done' in result.output
assert 'ERROR: Unrecognized archive format' in result.output
assert 'Extraction errors or warnings' in result.output
assert os.path.exists(os.path.join(test_dir, 'some.tar.gz-extract'))

def test_copyright_option_detects_copyrights(self):
Expand Down

0 comments on commit b8e0a8f

Please sign in to comment.