-
-
Notifications
You must be signed in to change notification settings - Fork 561
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove summarizer2.py Reference: #2842 Signed-off-by: Jono Yang <jyang@nexb.com>
- Loading branch information
Showing
4 changed files
with
141 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# | ||
# Copyright (c) nexB Inc. and others. All rights reserved. | ||
# ScanCode is a trademark of nexB Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text. | ||
# See https://github.com/nexB/scancode-toolkit for support or download. | ||
# See https://aboutcode.org for more information about nexB OSS projects. | ||
# | ||
|
||
|
||
from os import path | ||
|
||
import pytest | ||
|
||
from commoncode.testcase import FileDrivenTesting | ||
|
||
from scancode.cli_test_utils import check_json_scan | ||
from scancode.cli_test_utils import check_jsonlines_scan | ||
from scancode.cli_test_utils import run_scan_click | ||
from scancode_config import REGEN_TEST_FIXTURES | ||
|
||
|
||
pytestmark = pytest.mark.scanslow | ||
|
||
|
||
class TestScanSummaryLegacy(FileDrivenTesting): | ||
|
||
test_data_dir = path.join(path.dirname(__file__), 'data') | ||
|
||
def test_copyright_summary_base(self): | ||
test_dir = self.get_test_loc('summary_legacy/copyright_summary/scan') | ||
result_file = self.get_temp_file('json') | ||
expected_file = self.get_test_loc('summary_legacy/copyright_summary/summary.expected.json') | ||
run_scan_click(['-c', '--summary-legacy', '--json-pp', result_file, test_dir]) | ||
check_json_scan(expected_file, result_file, remove_file_date=True, regen=REGEN_TEST_FIXTURES) | ||
|
||
def test_copyright_summary_with_details(self): | ||
test_dir = self.get_test_loc('summary_legacy/copyright_summary/scan') | ||
result_file = self.get_temp_file('json') | ||
expected_file = self.get_test_loc('summary_legacy/copyright_summary/summary_details.expected.json') | ||
run_scan_click(['-c', '--summary-with-details', '--json-pp', result_file, test_dir]) | ||
check_json_scan(expected_file, result_file, remove_file_date=True, regen=REGEN_TEST_FIXTURES) | ||
|
||
def test_copyright_summary_with_details_plain_json(self): | ||
test_dir = self.get_test_loc('summary_legacy/copyright_summary/scan') | ||
result_file = self.get_temp_file('json') | ||
expected_file = self.get_test_loc('summary_legacy/copyright_summary/summary_details.expected2.json') | ||
run_scan_click(['-c', '--summary-with-details', '--json', result_file, test_dir]) | ||
check_json_scan(expected_file, result_file, remove_file_date=True, regen=REGEN_TEST_FIXTURES) | ||
|
||
def test_copyright_summary_does_not_crash(self): | ||
test_dir = self.get_test_loc('summary_legacy/copyright_summary/scan2') | ||
result_file = self.get_temp_file('json') | ||
expected_file = self.get_test_loc('summary_legacy/copyright_summary/summary2.expected.json') | ||
run_scan_click(['-c', '--summary-legacy', '--json-pp', result_file, test_dir]) | ||
check_json_scan(expected_file, result_file, remove_file_date=True, regen=REGEN_TEST_FIXTURES) | ||
|
||
def test_full_summary_base(self): | ||
test_dir = self.get_test_loc('summary_legacy/full_summary/scan') | ||
result_file = self.get_temp_file('json') | ||
expected_file = self.get_test_loc('summary_legacy/full_summary/summary.expected.json') | ||
run_scan_click(['-clip', '--summary-legacy', '--json-pp', result_file, test_dir]) | ||
check_json_scan(expected_file, result_file, remove_instance_uuid=True, remove_file_date=True, regen=REGEN_TEST_FIXTURES) | ||
|
||
def test_full_summary_with_details(self): | ||
test_dir = self.get_test_loc('summary_legacy/full_summary/scan') | ||
result_file = self.get_temp_file('json') | ||
expected_file = self.get_test_loc('summary_legacy/full_summary/summary_details.expected.json') | ||
run_scan_click(['-clip', '--summary-with-details', '--json-pp', result_file, test_dir]) | ||
check_json_scan(expected_file, result_file, remove_instance_uuid=True, remove_file_date=True, regen=REGEN_TEST_FIXTURES) | ||
|
||
def test_copyright_summary_key_files(self): | ||
test_dir = self.get_test_loc('summary_legacy/copyright_summary/scan') | ||
result_file = self.get_temp_file('json') | ||
expected_file = self.get_test_loc('summary_legacy/copyright_summary/summary_key_files.expected.json') | ||
run_scan_click( | ||
['-c', '-i', '--classify', '--summary-legacy', '--summary-key-files', | ||
'--json-pp', result_file, test_dir]) | ||
|
||
check_json_scan(expected_file, result_file, remove_file_date=True, regen=REGEN_TEST_FIXTURES) | ||
|
||
def test_full_summary_key_files(self): | ||
test_dir = self.get_test_loc('summary_legacy/full_summary/scan') | ||
result_file = self.get_temp_file('json') | ||
expected_file = self.get_test_loc('summary_legacy/full_summary/summary_key_files.expected.json') | ||
run_scan_click( | ||
['-cli', '--classify', '--summary-legacy', '--summary-key-files', | ||
'--json-pp', result_file, test_dir]) | ||
check_json_scan(expected_file, result_file, remove_file_date=True, regen=REGEN_TEST_FIXTURES) | ||
|
||
def test_full_summary_key_files_json_lines(self): | ||
test_dir = self.get_test_loc('summary_legacy/full_summary/scan') | ||
result_file = self.get_temp_file('json') | ||
expected_file = self.get_test_loc('summary_legacy/full_summary/summary_key_files-details.expected.json-lines') | ||
run_scan_click( | ||
['-cli', '--classify', '--summary-legacy', '--summary-key-files', | ||
'--json-lines', result_file, test_dir]) | ||
check_jsonlines_scan(expected_file, result_file, remove_file_date=True, regen=REGEN_TEST_FIXTURES) | ||
|
||
def test_full_summary_by_facet(self): | ||
test_dir = self.get_test_loc('summary_legacy/full_summary/scan') | ||
result_file = self.get_temp_file('json') | ||
expected_file = self.get_test_loc('summary_legacy/full_summary/summary_by_facet.expected.json') | ||
run_scan_click([ | ||
'-clpieu', | ||
'--facet', 'dev=*.java', | ||
'--facet', 'dev=*.cs', | ||
'--facet', 'dev=*ada*', | ||
'--facet', 'data=*.S', | ||
'--facet', 'tests=*infback9*', | ||
'--facet', 'docs=*README', | ||
'--summary-legacy', | ||
'--summary-by-facet', | ||
'--json-pp', result_file, test_dir | ||
]) | ||
check_json_scan(expected_file, result_file, remove_instance_uuid=True, remove_file_date=True, regen=REGEN_TEST_FIXTURES) | ||
|
||
def test_end2end_summary_and_classify_works_with_empty_dir_and_empty_values(self): | ||
test_dir = self.extract_test_tar('summary_legacy/end-2-end/bug-1141.tar.gz') | ||
result_file = self.get_temp_file('json') | ||
expected_file = self.get_test_loc('summary_legacy/end-2-end/bug-1141.expected.json') | ||
run_scan_click([ | ||
'-clip', | ||
'--classify', | ||
'--facet', 'dev=*.java', | ||
'--summary-legacy', | ||
'--summary-key-files', | ||
'--json-pp', result_file, test_dir | ||
]) | ||
check_json_scan(expected_file, result_file, remove_instance_uuid=True, remove_file_date=True, regen=REGEN_TEST_FIXTURES) | ||
|
||
def test_summary_with_packages_reports_packages_with_files(self): | ||
test_dir = self.get_test_loc('summary_legacy/packages/scan') | ||
result_file = self.get_temp_file('json') | ||
expected_file = self.get_test_loc('summary_legacy/packages/expected.json') | ||
run_scan_click([ | ||
'--package', | ||
'--summary-legacy', | ||
'--json-pp', result_file, test_dir | ||
]) | ||
check_json_scan(expected_file, result_file, remove_instance_uuid=True, remove_file_date=True, regen=REGEN_TEST_FIXTURES) |
Oops, something went wrong.