예제 #1
0
 def test_set_classification_flags_is_package_data_file(self):
     test_dir = self.get_test_loc('classify/manifest')
     codebase = Codebase(
         test_dir, resource_attributes=FileClassifier.resource_attributes)
     for res in codebase.walk():
         if not res.is_file:
             continue
         set_classification_flags(res)
         assert res.is_manifest
예제 #2
0
 def test_set_classification_flags_not_is_legal(self):
     test_dir = self.get_test_loc('classify/not-legal')
     codebase = Codebase(
         test_dir, resource_attributes=FileClassifier.resource_attributes)
     for res in codebase.walk():
         if not res.is_file:
             continue
         set_classification_flags(res)
         assert not res.is_legal
예제 #3
0
 def test_package_root_is_properly_returned_for_metainf_poms(self):
     from packagedcode.plugin_package import PackageScanner
     test_dir = self.get_test_loc('maven_misc/package_root')
     codebase = Codebase(test_dir, resource_attributes=PackageScanner.resource_attributes)
     manifest_resource = [r for r in codebase.walk() if r.name == 'pom.xml'][0]
     packages = list(maven.MavenPomPackage.recognize(manifest_resource.location))
     assert packages
     manifest_resource.packages.append(packages[0].to_dict())
     manifest_resource.save(codebase)
     proot = maven.MavenPomPackage.get_package_root(manifest_resource, codebase)
     assert proot.name == 'activiti-image-generator-7-201802-EA-sources.jar-extract'
예제 #4
0
 def check_ProcessIgnore(self, test_dir, expected, ignore):
     codebase = Codebase(test_dir, strip_root=True)
     test_plugin = ProcessIgnore()
     test_plugin.process_codebase(codebase, ignore=ignore)
     resources = [res.path for res in codebase.walk(skip_root=True)]
     assert expected == sorted(resources)