Skip to content

Commit b8e0a8f

Browse files
committed
Fixed bug when extraction warning are displayed.
1 parent 63f631d commit b8e0a8f

4 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/scancode/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def extract_with_progress(input, verbose=False):
325325
click.secho('Extracting: ' + xev.source + ': ', nl=False, fg='green')
326326
else:
327327
if xev.warnings or xev.errors:
328-
click.secho('done.', fg='red')
328+
click.secho('done.', fg='red' if xev.errors else 'yellow')
329329
display_extract_event(xev)
330330
else:
331331
click.secho('done.', fg='green')
@@ -334,5 +334,5 @@ def extract_with_progress(input, verbose=False):
334334
def display_extract_event(xev):
335335
for e in xev.errors:
336336
click.secho(' ERROR: ' + e, fg='red')
337-
for warn in xev.warnings.values():
337+
for warn in xev.warnings:
338338
click.secho(' WARNING: ' + warn, fg='yellow')
223 Bytes
Binary file not shown.
217 Bytes
Binary file not shown.

tests/scancode/test_cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def test_extract_option_does_extract(self):
6767
result = runner.invoke(cli.scancode, ['--extract', test_dir])
6868
assert result.exit_code == 0
6969
assert 'Extracting done' in result.output
70+
assert 'ERROR: Unrecognized archive format' in result.output
71+
assert 'Extraction errors or warnings' in result.output
7072
assert os.path.exists(os.path.join(test_dir, 'some.tar.gz-extract'))
7173

7274
def test_copyright_option_detects_copyrights(self):

0 commit comments

Comments
 (0)