def test_simple_upgrade(self): r_jobs = [_Job([], "upgrade", None)] request = Request(self.pool) request.upgrade() self.assertEqual(request.jobs, r_jobs)
def test_simple_remove(self): r_jobs = [ _Job([self.numpy_1_7_0], "remove", R("numpy")), ] request = Request(self.pool) request.remove(R("numpy")) self.assertEqual(request.jobs, r_jobs)
def test_simple_install(self): r_jobs = [ _Job([self.scipy_0_12_0], "install", R("scipy")), _Job([self.numpy_1_7_0], "install", R("numpy")), ] request = Request(self.pool) request.install(R("scipy")) request.install(R("numpy")) self.assertEqual(request.jobs, r_jobs)
def test_simple_update(self): installed_packages = [P("mkl-10.2.0")] remote_packages = [P("mkl-11.0.0")] solver = self._create_solver(installed_packages, remote_packages) request = Request(solver.pool) request.update(R("mkl")) solver._compute_package_maps(request) self.assertEqual(solver._id_to_installed_package, {1: P("mkl-10.2.0")}) self.assertEqual(solver._id_to_updated_state, {1: True})
def test_empty_installed_set(self): installed_packages = [] remote_packages = [P("mkl-11.0.0")] solver = self._create_solver(installed_packages, remote_packages) request = Request(solver.pool) request.install(R("mkl")) solver._compute_package_maps(request) self.assertEqual(solver._id_to_installed_package, {}) self.assertEqual(solver._id_to_updated_state, {})
def test_create_depends_rule(self): r_rule = PackageRule.from_string(self.pool, "-numpy-1.6.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", None) req = R("numpy") request = Request(self.pool) request.install(req) rules_generator = RulesGenerator(self.pool, request, OrderedDict()) dependencies = self.pool.what_provides(self.numpy_1_6_0.dependencies[0]) rule = rules_generator._create_dependency_rule(self.numpy_1_6_0, dependencies, None) self.assertTrue(rule.is_equivalent(r_rule))
def test_create_depends_rule(self): r_rule = PackageRule.from_string( self.pool, "-numpy-1.6.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", None) req = R("numpy") request = Request(self.pool) request.install(req) rules_generator = RulesGenerator(self.pool, request, OrderedDict()) dependencies = self.pool.what_provides( self.numpy_1_6_0.dependencies[0]) rule = rules_generator._create_dependency_rule(self.numpy_1_6_0, dependencies, None) self.assertTrue(rule.is_equivalent(r_rule))
def from_data(cls, remote_packages, installed_packages, request_jobs): remote_repository = Repository( packages=[P(p.package_string) for p in remote_packages]) installed_repository = Repository( packages=[P(p.package_string) for p in installed_packages]) pool = Pool([remote_repository, installed_repository]) request = Request(pool) for name, requirement_string in request_jobs: getattr(request, name)(R(requirement_string)) return cls(remote_repository=remote_repository, installed_repository=installed_repository, pool=pool, request=request)