def test_repr(self): rule_repr = repr(PackageRule.from_packages([mkl_11_0_0, mkl_10_1_0, mkl_10_2_0], self.pool)) self.assertEqual(rule_repr, "(+mkl-10.1.0 | +mkl-10.2.0 | +mkl-11.0.0)") rule_repr = repr(PackageRule([PackageNot.from_package(mkl_10_2_0, self.pool)], self.pool) \ | PackageRule.from_packages([mkl_11_0_0], self.pool)) self.assertEqual(rule_repr, "(-mkl-10.2.0 | +mkl-11.0.0)")
def test_multiple_install_provides(self): # Installed requirement has > 1 one provide repo = Repository([ mkl_10_1_0, mkl_10_2_0, mkl_10_3_0, mkl_11_0_0, numpy_1_6_1, numpy_1_7_0 ]) pool = Pool() pool.add_repository(repo) r_rules = set() r_rules.add(PackageRule.from_string("numpy-1.7.0 | numpy-1.6.1", pool)) r_rules.add( PackageRule.from_string("-numpy-1.7.0 | -numpy-1.6.1", pool)) r_rules.add( PackageRule.from_string( "-numpy-1.7.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool)) r_rules.add( PackageRule.from_string( "-numpy-1.6.1 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.2.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.3.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-10.3.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.3.0 | -mkl-11.0.0", pool)) self.assertEqual(r_rules, set(create_install_rules(pool, R("numpy"))))
def test_repr(self): rule_repr = repr( PackageRule.from_packages([mkl_11_0_0, mkl_10_1_0, mkl_10_2_0], self.pool)) self.assertEqual(rule_repr, "(+mkl-10.1.0 | +mkl-10.2.0 | +mkl-11.0.0)") rule_repr = repr(PackageRule([PackageNot.from_package(mkl_10_2_0, self.pool)], self.pool) \ | PackageRule.from_packages([mkl_11_0_0], self.pool)) self.assertEqual(rule_repr, "(-mkl-10.2.0 | +mkl-11.0.0)")
def test_multiple_provided_names_single_install_provide(self): # Installed requirement has 1 one provide, but multiple provides for # the same name are available in the pool repo = Repository([ mkl_10_1_0, mkl_10_2_0, mkl_10_3_0, mkl_11_0_0, numpy_1_6_1, numpy_1_7_0 ]) pool = Pool() pool.add_repository(repo) r_rules = set() r_rules.add(PackageRule.from_string("numpy-1.7.0", pool)) r_rules.add( PackageRule.from_string("-numpy-1.7.0 | -numpy-1.6.1", pool)) r_rules.add( PackageRule.from_string( "-numpy-1.7.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.2.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.3.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-10.3.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.3.0 | -mkl-11.0.0", pool)) self.assertEqual(r_rules, set(create_install_rules(pool, R("numpy == 1.7.0"))))
def test_iter_conflict_rules(self): # Making sure single package corner-case works self.assertEqual(set(), set(iter_conflict_rules(self.pool, [mkl_10_1_0]))) # 3 packages conflicting with each other -> 3 rules (C_3^2) r_rules = set() r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.2.0", self.pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.3.0", self.pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-10.3.0", self.pool)) self.assertEqual(r_rules, set(iter_conflict_rules(self.pool, [mkl_10_1_0, mkl_10_2_0, mkl_10_3_0])))
def test_str(self): rule = PackageRule.from_packages( self.pool, [self.mkl_11_0_0, self.mkl_10_1_0, self.mkl_10_2_0], None) rule_repr = str(rule) self.assertEqual(rule_repr, "(+mkl-10.1.0 | +mkl-10.2.0 | +mkl-11.0.0)") rule_repr = str( PackageRule(self.pool, [-self.mkl_10_2_0.id, self.mkl_11_0_0.id], None)) self.assertEqual(rule_repr, "(-mkl-10.2.0 | +mkl-11.0.0)")
def test_str_simple(self): repository = Repository([P("mkl-10.1.0"), P("numpy-1.7.0; depends (MKL >= 10.1.0)"), P("scipy-0.12.0; depends (numpy >= 1.7.0)")]) pool = Pool([repository]) rule = PackageRule(pool, [1, 2], "job_install", "scipy") self.assertEqual(str(rule), "(+mkl-10.1.0 | +numpy-1.7.0)") rule = PackageRule(pool, [-1, 2], "job_install", "scipy") self.assertEqual(str(rule), "(-mkl-10.1.0 | +numpy-1.7.0)")
def test_from_package_string(self): rule = PackageRule.from_string("mkl-11.0.0", self.pool) self.assertEqual(rule, PackageRule.from_packages([mkl_11_0_0], self.pool)) rule = PackageRule.from_string("mkl-10.2.0 | mkl-11.0.0", self.pool) self.assertEqual( rule, PackageRule.from_packages([mkl_10_2_0, mkl_11_0_0], self.pool)) rule = PackageRule.from_string("-mkl-10.2.0 | mkl-11.0.0", self.pool) self.assertEqual( rule, PackageRule([ PackageNot.from_package(mkl_10_2_0, self.pool), PackageLiteral.from_package(mkl_11_0_0, self.pool) ], self.pool)) rule = PackageRule.from_string("-mkl-10.2.0 | -mkl-11.0.0", self.pool) self.assertEqual( rule, PackageRule([ PackageNot.from_package(mkl_10_2_0, self.pool), PackageNot.from_package(mkl_11_0_0, self.pool) ], self.pool))
def test_create_depends_rule(self): r_rule = PackageRule.from_string( "-numpy-1.6.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", self.pool) rule = create_depends_rule(self.pool, numpy_1_6_0, R("mkl")) self.assertEqual(rule, r_rule)
def create_install_rules(pool, req): """Creates the list of rules for the given install requirement.""" clauses = [] clauses_set = set() def _append_rule(rule): if not rule in clauses_set: clauses_set.add(rule) clauses.append(rule) def _extend_rules(rules): for rule in rules: _append_rule(rule) def _add_dependency_rules(req): provided = pool.what_provides(req, 'include_indirect') if len(provided) < 1: raise MissingRequirementInPool(req) else: obsolete_provided = pool.what_provides(req, 'any') _extend_rules(iter_conflict_rules(pool, obsolete_provided)) for candidate in provided: for dependency_req in candidate.dependencies: _append_rule(create_depends_rule(pool, candidate, dependency_req)) _extend_rules(_add_dependency_rules(dependency_req)) return clauses provided = pool.what_provides(req) rule = PackageRule.from_packages(provided, pool) _append_rule(rule) return _add_dependency_rules(req)
def create_install_rules(pool, req): """Creates the list of rules for the given install requirement.""" clauses = [] clauses_set = set() def _append_rule(rule): if not rule in clauses_set: clauses_set.add(rule) clauses.append(rule) def _extend_rules(rules): for rule in rules: _append_rule(rule) def _add_dependency_rules(req): provided = pool.what_provides(req, 'include_indirect') if len(provided) < 1: raise MissingRequirementInPool(req) else: obsolete_provided = pool.what_provides(req, 'any') _extend_rules(iter_conflict_rules(pool, obsolete_provided)) for candidate in provided: for dependency_req in candidate.dependencies: _append_rule( create_depends_rule(pool, candidate, dependency_req)) _extend_rules(_add_dependency_rules(dependency_req)) return clauses provided = pool.what_provides(req) rule = PackageRule.from_packages(provided, pool) _append_rule(rule) return _add_dependency_rules(req)
def test_str(self): rule = PackageRule.from_packages(self.pool, [self.mkl_11_0_0, self.mkl_10_1_0, self.mkl_10_2_0], None) rule_repr = str(rule) self.assertEqual(rule_repr, "(+mkl-10.1.0 | +mkl-10.2.0 | +mkl-11.0.0)") rule_repr = str(PackageRule(self.pool, [-self.mkl_10_2_0.id, self.mkl_11_0_0.id], None)) self.assertEqual(rule_repr, "(-mkl-10.2.0 | +mkl-11.0.0)")
def test_already_installed_indirect_provided(self): # Installed requirement has one dependency with multiple provides for # the same name available in the pool, one of which is already # installed. Here: scipy depends on numpy, nomkl_numpy is also # available and already installed repo = Repository([mkl_11_0_0, nomkl_numpy_1_7_0, numpy_1_7_0, scipy_0_11_0]) pool = Pool() pool.add_repository(repo) r_rules = set() r_rules.add(PackageRule.from_string("scipy-0.11.0", pool)) r_rules.add(PackageRule.from_string("-scipy-0.11.0 | numpy-1.7.0 | nomkl_numpy-1.7.0", pool)) r_rules.add(PackageRule.from_string("-numpy-1.7.0 | -nomkl_numpy-1.7.0", pool)) r_rules.add(PackageRule.from_string( "-numpy-1.7.0 | mkl-11.0.0", pool)) self.assertEqual(r_rules, set(create_install_rules(pool, R("scipy"))))
def test_iter_conflict_rules(self): # Making sure single package corner-case works self.assertEqual(set(), set(iter_conflict_rules(self.pool, [mkl_10_1_0]))) # 3 packages conflicting with each other -> 3 rules (C_3^2) r_rules = set() r_rules.add( PackageRule.from_string("-mkl-10.1.0 | -mkl-10.2.0", self.pool)) r_rules.add( PackageRule.from_string("-mkl-10.1.0 | -mkl-10.3.0", self.pool)) r_rules.add( PackageRule.from_string("-mkl-10.2.0 | -mkl-10.3.0", self.pool)) self.assertEqual( r_rules, set( iter_conflict_rules(self.pool, [mkl_10_1_0, mkl_10_2_0, mkl_10_3_0])))
def test_already_installed_indirect_provided(self): # Installed requirement has one dependency with multiple provides for # the same name available in the pool, one of which is already # installed. Here: scipy depends on numpy, nomkl_numpy is also # available and already installed repo = Repository( [mkl_11_0_0, nomkl_numpy_1_7_0, numpy_1_7_0, scipy_0_11_0]) pool = Pool() pool.add_repository(repo) r_rules = set() r_rules.add(PackageRule.from_string("scipy-0.11.0", pool)) r_rules.add( PackageRule.from_string( "-scipy-0.11.0 | numpy-1.7.0 | nomkl_numpy-1.7.0", pool)) r_rules.add( PackageRule.from_string("-numpy-1.7.0 | -nomkl_numpy-1.7.0", pool)) r_rules.add(PackageRule.from_string("-numpy-1.7.0 | mkl-11.0.0", pool)) self.assertEqual(r_rules, set(create_install_rules(pool, R("scipy"))))
def test_ctor_simple(self): repository = Repository([P("mkl-10.1.0"), P("numpy-1.7.0; depends (MKL >= 10.1.0)"), P("scipy-0.12.0; depends (numpy >= 1.7.0)")]) pool = Pool([repository]) rule = PackageRule(pool, [1, 2], "job_install", "scipy") self.assertEqual(rule.enabled, True) self.assertEqual(rule.literals, [1, 2]) self.assertEqual(rule.reason, "job_install") self.assertEqual(rule.rule_hash, "05cf2")
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_simple(self): repository = Repository([ P("mkl-10.1.0"), P("numpy-1.7.0; depends (MKL >= 10.1.0)"), P("scipy-0.12.0; depends (numpy >= 1.7.0)") ]) pool = Pool([repository]) rule = PackageRule(pool, [1, 2], "job_install", "scipy") rules_set = RulesSet() rules_set.add_rule(rule, "package") self.assertEqual(len(rules_set), 1)
def test_multiple_install_provides(self): # Installed requirement has > 1 one provide repo = Repository([mkl_10_1_0, mkl_10_2_0, mkl_10_3_0, mkl_11_0_0, numpy_1_6_1, numpy_1_7_0]) pool = Pool() pool.add_repository(repo) r_rules = set() r_rules.add(PackageRule.from_string("numpy-1.7.0 | numpy-1.6.1", pool)) r_rules.add(PackageRule.from_string("-numpy-1.7.0 | -numpy-1.6.1", pool)) r_rules.add(PackageRule.from_string( "-numpy-1.7.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string( "-numpy-1.6.1 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.2.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.3.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-10.3.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.3.0 | -mkl-11.0.0", pool)) self.assertEqual(r_rules, set(create_install_rules(pool, R("numpy"))))
def test_create_install_rules_simple(self): r_rules = set() r_rules.add(PackageRule.from_string( "mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", self.pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.2.0", self.pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.3.0", self.pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-11.0.0", self.pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-10.3.0", self.pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-11.0.0", self.pool)) r_rules.add(PackageRule.from_string("-mkl-10.3.0 | -mkl-11.0.0", self.pool)) self.assertEqual(r_rules, set(create_install_rules(self.pool, R("mkl"))))
def test_from_packages_simple(self): mkl = P("mkl-10.1.0") numpy = P("numpy-1.7.0; depends (MKL >= 10.1.0)") scipy = P("scipy-0.12.0; depends (numpy >= 1.7.0)") remote_repository = [mkl, numpy, scipy] i_mkl = P("mkl-10.1.0") installed_repository = [i_mkl] pool = Pool([Repository(remote_repository), Repository(installed_repository)]) rule = PackageRule.from_packages(pool, [mkl, i_mkl], "job_install", "numpy") self.assertEqual(rule.enabled, True) self.assertEqual(rule.literals, [mkl.id, i_mkl.id]) self.assertEqual(rule.reason, "job_install")
def test_multiple_provided_names_single_install_provide(self): # Installed requirement has 1 one provide, but multiple provides for # the same name are available in the pool repo = Repository([mkl_10_1_0, mkl_10_2_0, mkl_10_3_0, mkl_11_0_0, numpy_1_6_1, numpy_1_7_0]) pool = Pool() pool.add_repository(repo) r_rules = set() r_rules.add(PackageRule.from_string("numpy-1.7.0", pool)) r_rules.add(PackageRule.from_string("-numpy-1.7.0 | -numpy-1.6.1", pool)) r_rules.add(PackageRule.from_string( "-numpy-1.7.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.2.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.3.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-10.3.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.3.0 | -mkl-11.0.0", pool)) self.assertEqual(r_rules, set(create_install_rules(pool, R("numpy == 1.7.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))
def test_from_package_string(self): r_rule = PackageRule.from_packages(self.pool, [self.mkl_11_0_0], None) rule = PackageRule.from_string(self.pool, "mkl-11.0.0", None) self.assertTrue(rule.is_equivalent(r_rule)) r_rule = PackageRule.from_packages(self.pool, [self.mkl_10_2_0, self.mkl_11_0_0], None) rule = PackageRule.from_string(self.pool, "mkl-10.2.0 | mkl-11.0.0", None) self.assertTrue(rule.is_equivalent(r_rule)) r_rule = PackageRule(self.pool, [-self.mkl_10_2_0.id, self.mkl_11_0_0.id], None) rule = PackageRule.from_string(self.pool, "-mkl-10.2.0 | mkl-11.0.0", None) self.assertTrue(rule.is_equivalent(r_rule)) r_rule = PackageRule(self.pool, [-self.mkl_10_2_0.id, -self.mkl_11_0_0.id], None) rule = PackageRule.from_string(self.pool, "-mkl-10.2.0 | -mkl-11.0.0", None) self.assertTrue(rule.is_equivalent(r_rule))
def test_from_package_string(self): rule = PackageRule.from_string("mkl-11.0.0", self.pool) self.assertEqual(rule, PackageRule.from_packages([mkl_11_0_0], self.pool)) rule = PackageRule.from_string("mkl-10.2.0 | mkl-11.0.0", self.pool) self.assertEqual(rule, PackageRule.from_packages([mkl_10_2_0, mkl_11_0_0], self.pool)) rule = PackageRule.from_string("-mkl-10.2.0 | mkl-11.0.0", self.pool) self.assertEqual(rule, PackageRule([PackageNot.from_package(mkl_10_2_0, self.pool), PackageLiteral.from_package(mkl_11_0_0, self.pool)], self.pool)) rule = PackageRule.from_string("-mkl-10.2.0 | -mkl-11.0.0", self.pool) self.assertEqual(rule, PackageRule([PackageNot.from_package(mkl_10_2_0, self.pool), PackageNot.from_package(mkl_11_0_0, self.pool)], self.pool))
def test_create_install_rules_simple(self): r_rules = set() r_rules.add( PackageRule.from_string( "mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", self.pool)) r_rules.add( PackageRule.from_string("-mkl-10.1.0 | -mkl-10.2.0", self.pool)) r_rules.add( PackageRule.from_string("-mkl-10.1.0 | -mkl-10.3.0", self.pool)) r_rules.add( PackageRule.from_string("-mkl-10.1.0 | -mkl-11.0.0", self.pool)) r_rules.add( PackageRule.from_string("-mkl-10.2.0 | -mkl-10.3.0", self.pool)) r_rules.add( PackageRule.from_string("-mkl-10.2.0 | -mkl-11.0.0", self.pool)) r_rules.add( PackageRule.from_string("-mkl-10.3.0 | -mkl-11.0.0", self.pool)) self.assertEqual(r_rules, set(create_install_rules(self.pool, R("mkl"))))
def test_or(self): rule = PackageRule.from_packages([mkl_10_1_0, mkl_10_2_0], self.pool) rule |= PackageNot.from_package(mkl_11_0_0, self.pool) self.assertTrue(rule.literals, set([mkl_11_0_0.id, mkl_10_1_0.id, mkl_10_2_0.id]))
def test_complex_scenario_1(self): repo = Repository([ mkl_10_1_0, mkl_10_2_0, mkl_10_3_0, mkl_11_0_0, numpy_1_6_0, numpy_1_6_1, numpy_1_7_0, scipy_0_11_0, scipy_0_12_0 ]) pool = Pool() pool.add_repository(repo) r_rules = set() r_rules.add( PackageRule.from_string("scipy-0.11.0 | scipy-0.12.0", pool)) r_rules.add( PackageRule.from_string("-scipy-0.11.0 | -scipy-0.12.0", pool)) r_rules.add( PackageRule.from_string( "-scipy-0.11.0 | numpy-1.6.0 | numpy-1.6.1 | numpy-1.7.0", pool)) r_rules.add( PackageRule.from_string( "-scipy-0.12.0 | numpy-1.6.0 | numpy-1.6.1 | numpy-1.7.0", pool)) r_rules.add( PackageRule.from_string("-numpy-1.7.0 | -numpy-1.6.1", pool)) r_rules.add( PackageRule.from_string("-numpy-1.7.0 | -numpy-1.6.0", pool)) r_rules.add( PackageRule.from_string("-numpy-1.6.0 | -numpy-1.6.1", pool)) r_rules.add( PackageRule.from_string( "-numpy-1.7.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool)) r_rules.add( PackageRule.from_string( "-numpy-1.6.1 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool)) r_rules.add( PackageRule.from_string( "-numpy-1.6.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.2.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.3.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-10.3.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.3.0 | -mkl-11.0.0", pool)) self.assertEqual(r_rules, set(create_install_rules(pool, R("scipy"))))
def test_complex_scenario_1(self): repo = Repository([mkl_10_1_0, mkl_10_2_0, mkl_10_3_0, mkl_11_0_0, numpy_1_6_0, numpy_1_6_1, numpy_1_7_0, scipy_0_11_0, scipy_0_12_0]) pool = Pool() pool.add_repository(repo) r_rules = set() r_rules.add(PackageRule.from_string("scipy-0.11.0 | scipy-0.12.0", pool)) r_rules.add(PackageRule.from_string("-scipy-0.11.0 | -scipy-0.12.0", pool)) r_rules.add(PackageRule.from_string( "-scipy-0.11.0 | numpy-1.6.0 | numpy-1.6.1 | numpy-1.7.0", pool)) r_rules.add(PackageRule.from_string( "-scipy-0.12.0 | numpy-1.6.0 | numpy-1.6.1 | numpy-1.7.0", pool)) r_rules.add(PackageRule.from_string("-numpy-1.7.0 | -numpy-1.6.1", pool)) r_rules.add(PackageRule.from_string("-numpy-1.7.0 | -numpy-1.6.0", pool)) r_rules.add(PackageRule.from_string("-numpy-1.6.0 | -numpy-1.6.1", pool)) r_rules.add(PackageRule.from_string( "-numpy-1.7.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string( "-numpy-1.6.1 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string( "-numpy-1.6.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.2.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.3.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-10.3.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-11.0.0", pool)) r_rules.add(PackageRule.from_string("-mkl-10.3.0 | -mkl-11.0.0", pool)) self.assertEqual(r_rules, set(create_install_rules(pool, R("scipy"))))