Skip to content

Commit 80991cd

Browse files
committed
#388 and #417 Split output tests in two
* Based on suggestion by @akaihola * We still have two tests and the second is checking that the output to a file or stdout are identical and that the stdout outpout contains only scan results. * We cannot test easily that the progressbar is sent to stderr as Click test utilities capture all outputs at once mixing stderr and stdout Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 8effe4b commit 80991cd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/scancode/test_cli.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,17 @@ def test_scan_can_handle_licenses_with_unicode_metadata(monkeypatch):
466466
assert 'Scanning done' in result.output
467467

468468

469-
def test_scan_quiet_does_not_echo_anything(monkeypatch):
469+
def test_scan_quiet_to_file_does_not_echo_anything(monkeypatch):
470+
monkeypatch.setattr(click._termui_impl, 'isatty', lambda _: True)
471+
test_dir = test_env.extract_test_tar('info/basic.tgz')
472+
runner = CliRunner()
473+
result1_file = test_env.get_temp_file('json')
474+
result1 = runner.invoke(cli.scancode, ['--quiet', '--info', test_dir, result1_file], catch_exceptions=True)
475+
assert result1.exit_code == 0
476+
assert not result1.output
477+
478+
479+
def test_scan_quiet_to_stdout_only_echoes_json_results(monkeypatch):
470480
monkeypatch.setattr(click._termui_impl, 'isatty', lambda _: True)
471481
test_dir = test_env.extract_test_tar('info/basic.tgz')
472482
runner = CliRunner()

0 commit comments

Comments
 (0)