Skip to content

Commit

Permalink
Merge branch 'main' into feature/license-creation-checking-path
Browse files Browse the repository at this point in the history
  • Loading branch information
ant-u authored Mar 18, 2024
2 parents 8f72294 + 87b062a commit 3d912da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 10 additions & 1 deletion src/ros_license_toolkit/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,16 @@ def _check_licenses(self, package: Package) -> None:
f"License text file '{license_text_file}' is " +\
f"of license {actual_license} but tag is " +\
f"{license_tag.get_license_id()}."
self.missing_license_texts_status[license_tag] = Status.WARNING
# If Tag and File both are in SPDX but don't match -> Error
if is_license_name_in_spdx_list(license_tag.get_license_id()):
self.missing_license_texts_status[license_tag] =\
Status.FAILURE
else:
self.missing_license_texts_status[license_tag] =\
Status.WARNING
self.files_with_wrong_tags[license_tag] = \
{'actual_license': actual_license,
'license_tag': license_tag.get_license_id()}
continue

def _evaluate_results(self):
Expand Down
7 changes: 3 additions & 4 deletions test/systemtest/test_separate_pkgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,9 @@ def test_pkg_with_multiple_licenses_one_referenced_incorrect(self):

def test_pkg_wrong_license_file(self):
"""Test on a package with a license text file that does not match
the license declared in the package.xml."""
process, stdout = open_subprocess("test_pkg_wrong_license_file")
self.assertEqual(os.EX_OK, process.returncode)
self.assertIn(b"WARNING", stdout)
the license declared in the package.xml, both tag and file in spdx"""
self.assertEqual(os.EX_DATAERR, main(
["test/_test_data/test_pkg_wrong_license_file"]))


def open_subprocess(test_data_name: str):
Expand Down

0 comments on commit 3d912da

Please sign in to comment.