Пример #1
0
def print_rules(request, remote_repositories, installed_repository):
    pool = Pool(remote_repositories)
    pool.add_repository(installed_repository)

    solver = Solver(pool, remote_repositories, installed_repository)
    rules, _ = solver._create_rules_and_policy(request)
    for rule in rules:
        print(rule.to_string(pool))
Пример #2
0
def solve_and_print(request, remote_repositories, installed_repository,
                    print_ids):
    pool = Pool(remote_repositories)
    pool.add_repository(installed_repository)

    solver = Solver(pool, remote_repositories, installed_repository)
    transaction = solver.solve(request)
    print(transaction)
    def _check_solution(self, filename):
        # Test that the solution described in the scenario file matches with
        # what the SAT solver computes.

        # Given
        scenario = Scenario.from_yaml(os.path.join(os.path.dirname(__file__), 
                                      filename))
        request = scenario.request

        # When
        pool = Pool(scenario.remote_repositories)
        pool.add_repository(scenario.installed_repository)
        solver = Solver(pool, scenario.remote_repositories,
                        scenario.installed_repository)
        transaction = solver.solve(request)

        # Then
        self.assertEqualOperations(transaction.operations,
                                   scenario.operations)