def test_get_package_resources_on_nested_packages_should_include_manifest(
         self):
     from packagedcode import get_package_instance
     from commoncode.resource import VirtualCodebase
     scan_file = self.get_scan('plugin_consolidate/nested-packages',
                               cli_options='-p')
     codebase = VirtualCodebase(scan_file)
     for resource in codebase.walk():
         for package_data in resource.packages:
             package = get_package_instance(package_data)
             package_resources = list(
                 package.get_package_resources(resource, codebase))
             assert any(r.name == 'package.json'
                        for r in package_resources), resource.path
Exemple #2
0
 def test_Package_get_package_resource_works_with_nested_packages_and_ignores(
         self):
     from packagedcode import get_package_instance
     from packagedcode import npm
     from commoncode.resource import VirtualCodebase
     scan_loc = self.get_test_loc('models/nested-npm-packages.json')
     codebase = VirtualCodebase(scan_loc)
     for resource in codebase.walk():
         for package_data in resource.packages:
             package = get_package_instance(package_data)
             assert isinstance(package, npm.NpmPackage)
             package_resources = list(
                 package.get_package_resources(resource, codebase))
             assert any(r.name == 'package.json'
                        for r in package_resources), resource.path