Beispiel #1
0
 def test_init_from_package(self, mock_conf):
     mock_conf.return_value = self.conf_file
     create(self.test_dir, {'<name>': 'my_dep'})
     pack_path = join(self.test_dir, 'my_dep')
     builder = Builder.init_from_path(pack_path)
     self.assertEqual(True, builder.build())
     builder.package()
     pack = Package.from_package(join(pack_path, 'my_dep.ep'))
     self.assertEqual('my_dep', pack.name)
     self.assertEqual('0.0.1', pack.vsn)
     self.assertEqual([], pack.deps)
Beispiel #2
0
 def test_add_from_package(self, mock_conf):
     mock_conf.return_value = self.conf_file
     pack_path = join(self.test_dir, 'test_app')
     set_git_url(pack_path, 'http://github/comtihon/test_app')
     set_git_tag(pack_path, '1.0.0')
     builder = Builder.init_from_path(pack_path)
     self.assertEqual(True, builder.build())
     builder.package()
     new_package_path = join(self.test_dir, 'test_app.ep')
     # remove source project, test should work only with enot package
     copy_file(join(pack_path, 'test_app.ep'), new_package_path)
     remove_dir(pack_path)
     package = Package.from_package(new_package_path)
     self.assertEqual(False, builder.system_config.cache.exists_local(package))
     # local cache is used here to determine tmp dir
     local_cache = builder.system_config.cache.local_cache
     builder.system_config.cache.add_fetched(local_cache, package)
     self.assertEqual(True, builder.system_config.cache.exists_local(package))
Beispiel #3
0
 def init_from_package(cls, path_to_package) -> 'Builder':
     package = Package.from_package(path_to_package)
     return cls(path_to_package, package)
Beispiel #4
0
 def fetch_version(self, fullname: str, version: str) -> Package or None:
     [name] = fullname.split('/')[-1:]
     write_path = self.__download_package(name, fullname, version)
     return Package.from_package(write_path)