def test_set_repository(self): package = PackageInfo(name="numpy", version=V("1.3.0")) package.repository = Repository() def set_repository(): package.repository = Repository() self.assertRaises(ValueError, set_repository)
def test_replaces(self): r_package_string = "mkl_numpy-1.6.0; replaces (numpy == 1.6.0)" r_package = PackageInfo(name="mkl_numpy", version=V("1.6.0"), replaces=[R("numpy == 1.6.0")]) package = PackageInfo.from_string(r_package_string) self.assertEqual(package, r_package) self.assertEqual(package.package_string, r_package_string)
def test_dependencies(self): r_package_string = "numpy-1.6.0; depends (mkl >= 10.3.0)" r_package = PackageInfo(name="numpy", version=V("1.6.0"), dependencies=[R("mkl >= 10.3.0")]) package = PackageInfo.from_string(r_package_string) self.assertEqual(package, r_package) self.assertEqual(package.package_string, r_package_string)
def test_simple(self): r_package_string = "numpy-1.3.0" r_package = PackageInfo(name="numpy", version=V("1.3.0")) package = PackageInfo.from_string(r_package_string) self.assertEqual(package, r_package) self.assertEqual(package.package_string, r_package_string) self.assertRaises(DepSolverError, lambda: PackageInfo.from_string("numpy 1.3.0"))
def test_conflicts(self): r_package_string = "nomkl_numpy-1.6.0; conflicts (numpy == 1.6.0)" r_package = PackageInfo(name="nomkl_numpy", version=V("1.6.0"), conflicts=[R("numpy == 1.6.0")]) package = PackageInfo.from_string(r_package_string) self.assertEqual(package, r_package) self.assertEqual(package.package_string, r_package_string)
def test_suggests(self): r_package_string = "numpy-1.6.0; suggests (scipy == 1.6.0)" r_package = PackageInfo(name="numpy", version=V("1.6.0"), suggests=[R("scipy")]) package = PackageInfo.from_string(r_package_string) self.assertEqual(package, r_package) self.assertEqual(package.package_string, r_package_string)
def test_simple_construction(self): r_provides = [] package = PackageInfo("numpy", V("1.3.0")) self.assertEqual(package.provides, r_provides) self.assertEqual(package.dependencies, []) self.assertEqual(package.id, -1) r_provides = [R("numpy == 1.3.0")] r_id = -1 package = PackageInfo("nomkl_numpy", V("1.3.0"), provides=r_provides) self.assertEqual(package.provides, r_provides) self.assertEqual(package.id, r_id)
def test_multiple_dependencies(self): r_package_string = "scipy-0.12.0; depends (numpy >= 1.6.0, " \ "numpy < 1.7.0, MKL >= 10.3.0, MKL < 10.4.0)" r_package = PackageInfo(name="scipy", version=V("0.12.0"), dependencies=[ R("numpy >= 1.6.0, numpy < 1.7.0"), R("MKL >= 10.3.0, MKL < 10.4.0") ]) package = PackageInfo.from_string(r_package_string) self.assertEqual(package, r_package) self.assertEqual(package.package_string, r_package_string)
def test_repr(self): package = PackageInfo(name="numpy", version=V("1.3.0")) if six.PY3: self.assertEqual(repr(package), "PackageInfo('numpy-1.3.0')") else: self.assertEqual(repr(package), "PackageInfo(u'numpy-1.3.0')") package = PackageInfo(name="numpy", version=V("1.6.0"), dependencies=[R("mkl >= 10.3.0")]) if six.PY3: self.assertEqual( repr(package), "PackageInfo('numpy-1.6.0; depends (mkl >= 10.3.0)')") else: self.assertEqual( repr(package), "PackageInfo(u'numpy-1.6.0; depends (mkl >= 10.3.0)')")
def test_multiple_dependencies(self): r_package_string = "scipy-0.12.0; depends (numpy >= 1.6.0, " \ "numpy < 1.7.0, MKL >= 10.3.0, MKL < 10.4.0)" r_package = PackageInfo(name="scipy", version=V("0.12.0"), dependencies=[R("numpy >= 1.6.0, numpy < 1.7.0"), R("MKL >= 10.3.0, MKL < 10.4.0")]) package = PackageInfo.from_string(r_package_string) self.assertEqual(package, r_package) self.assertEqual(package.package_string, r_package_string)
def test_str(self): provides = [R("numpy == 1.3.0")] package = PackageInfo(name="nomkl_numpy", version=V("1.3.0"), provides=provides) self.assertEqual(str(package), "nomkl_numpy-1.3.0")
def test_unique_name(self): package = PackageInfo(name="numpy", version=V("1.3.0")) self.assertEqual(package.unique_name, "numpy-1.3.0")
import \ Repository from depsolver.requirement \ import \ Requirement from depsolver.solver.core \ import \ Install, Solver, Update from depsolver.solver.policy \ import \ DefaultPolicy R = Requirement.from_string mkl_10_1_0 = PackageInfo.from_string("mkl-10.1.0") mkl_10_2_0 = PackageInfo.from_string("mkl-10.2.0") mkl_10_3_0 = PackageInfo.from_string("mkl-10.3.0") mkl_11_0_0 = PackageInfo.from_string("mkl-11.0.0") numpy_1_6_0 = PackageInfo.from_string("numpy-1.6.0; depends (mkl)") numpy_1_6_1 = PackageInfo.from_string("numpy-1.6.1; depends (mkl)") numpy_1_7_0 = PackageInfo.from_string("numpy-1.7.0; depends (mkl)") nomkl_numpy_1_7_0 = PackageInfo.from_string("nomkl_numpy-1.7.0; depends (numpy == 1.7.0)") scipy_0_10_1 = PackageInfo.from_string("scipy-0.10.1; depends (numpy >= 1.6.0)") scipy_0_11_0 = PackageInfo.from_string("scipy-0.11.0; depends (numpy >= 1.6.0)") scipy_0_12_0 = PackageInfo.from_string("scipy-0.12.0; depends (numpy >= 1.7.0)") policy = DefaultPolicy()
import \ Repository from depsolver.requirement \ import \ Requirement from depsolver.solver.core \ import \ Install, Solver, Update from depsolver.solver.policy \ import \ DefaultPolicy R = Requirement.from_string mkl_10_1_0 = PackageInfo.from_string("mkl-10.1.0") mkl_10_2_0 = PackageInfo.from_string("mkl-10.2.0") mkl_10_3_0 = PackageInfo.from_string("mkl-10.3.0") mkl_11_0_0 = PackageInfo.from_string("mkl-11.0.0") numpy_1_6_0 = PackageInfo.from_string("numpy-1.6.0; depends (mkl)") numpy_1_6_1 = PackageInfo.from_string("numpy-1.6.1; depends (mkl)") numpy_1_7_0 = PackageInfo.from_string("numpy-1.7.0; depends (mkl)") nomkl_numpy_1_7_0 = PackageInfo.from_string( "nomkl_numpy-1.7.0; depends (numpy == 1.7.0)") scipy_0_10_1 = PackageInfo.from_string( "scipy-0.10.1; depends (numpy >= 1.6.0)") scipy_0_11_0 = PackageInfo.from_string( "scipy-0.11.0; depends (numpy >= 1.6.0)")