Beispiel #1
0
    def test_simple_upgrade(self):
        r_jobs = [_Job([], "upgrade", None)]

        request = Request(self.pool)
        request.upgrade()

        self.assertEqual(request.jobs, r_jobs)
Beispiel #2
0
    def test_simple_upgrade(self):
        r_jobs = [_Job([], "upgrade", None)]

        request = Request(self.pool)
        request.upgrade()

        self.assertEqual(request.jobs, r_jobs)
Beispiel #3
0
    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)
Beispiel #4
0
    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)
Beispiel #5
0
    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)
Beispiel #6
0
    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)
Beispiel #7
0
    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})
Beispiel #8
0
    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, {})
Beispiel #9
0
    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, {})
Beispiel #10
0
    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))
Beispiel #11
0
    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))
Beispiel #12
0
    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)