def __initialize_dependency(self, package_name: str) -> None: new_dep = Dependency(package_name) new_dep.set_version(self.manifest.get_required_version(package_name)) new_dep.set_repo(self.packages.get_repo_for_package(package_name)) if new_dep in self.__cache: new_dep.set_barrel_name( self.__cache.get_barrel_for_package(new_dep)) self.__add_dependency(new_dep)
def test_dependency_ne_with_different_repo(self): dep = Dependency("Depend") dep.set_version("1.2.3") dep.set_repo("owner/Depend") dep2 = Dependency("Depend") dep2.set_version("1.2.3") dep2.set_repo("owner2/Depend") self.assertNotEqual(dep, dep2)
def test_dependency_eq_with_other(self): dep = Dependency("Depend") dep.set_version("1.2.3") dep.set_repo("owner/Depend") dep2 = Dependency("Depend") dep2.set_version("1.2.3") dep2.set_repo("owner/Depend") self.assertEqual(dep, dep2)
def test_dependency_eq_with_different_barrel_name(self): dep = Dependency("Depend") dep.set_version("1.2.3") dep.set_repo("owner/Depend") dep.set_barrel_name("x.barrel") dep2 = Dependency("Depend") dep2.set_version("1.2.3") dep2.set_repo("owner/Depend") dep.set_barrel_name("y.barrel") self.assertEqual(dep, dep2)
def test_dependency_can_get_repo(self): dep = Dependency("Depend") dep.set_repo("owner/Depend") self.assertEqual("owner/Depend", dep.repo)