def test_020_duplicate_release(self): VersionsDB.Release("ARelease") try: VersionsDB.Release("ARelease") self.fail("DuplicatedReleaseError exception expected") except VersionsDB.DuplicatedReleaseError, x: self.assertEquals(x.release, "ARelease")
def test_030_add_project(self): r = VersionsDB.Release("ReleaseA") r["Project1"] = "v1r0" r["Project2"] = "v2r0" r = VersionsDB.Release("ReleaseB", base="ReleaseA") r["Project2"] = "v2r1" r = VersionsDB.getRelease("ReleaseA") self.assertEquals(r["Project1"].version, "v1r0") self.assertEquals(r["Project2"].version, "v2r0") r = VersionsDB.getRelease("ReleaseB") self.assertEquals(r["Project1"].version, "v1r0") self.assertEquals(r["Project2"].version, "v2r1")
def _prepareDBWithDeps(self): r = VersionsDB.Release("r1") for i in range(1, 8): r["p%d" % i] = "v1r0" r["p2"].addBuildTimeDep("p1") r["p3"].addBuildTimeDep("p1") r["p3"].addRunTimeDep("p2") r["p4"].addBuildTimeDep("p1") r["p5"].addRunTimeDep("p4") r["p6"].addBuildTimeDep("p3") r["p6"].addRunTimeDep("p5") r["p7"].addBuildTimeDep("p1") r["p7"].addBuildTimeDep("p2") r = VersionsDB.Release("r2", base="r1") r["z10"] = "v1r0" r["p5"] = "v1r1" r["p5"].addRunTimeDep("p4") r["p5"].addRunTimeDep("z10")
def test_600_release_date(self): def test(self): # check content of db r = VersionsDB.getRelease("R1") self.assertEquals(r.date, VersionsDB.DEFAULT_RELEASEDATE) r = VersionsDB.getRelease("R2") self.assertEquals(r.date, (2008, 5, 7)) # prepare db VersionsDB.Release("R1") VersionsDB.Release("R2", date=(2008, 5, 7)) test(self) # check XML generation xml = VersionsDB.generateXML() VersionsDB.loadString(xml) test(self)
def test_420_dependencies_loop(self): r = VersionsDB.Release("r1") r["a"] = "v1r0" r["b"] = "v1r0" r["c"] = "v1r0" r["b"].addBuildTimeDep("a") r["c"].addBuildTimeDep("b") r["a"].addBuildTimeDep("c") self.assertRaises(VersionsDB.DependencyLoopError, VersionsDB._sortProjects, [r['a'], r['b'], r['c']])
def test_610_project_version_tag(self): def test(self): # check content of db r = VersionsDB.getRelease("R1") self.assertEquals(r["p1"].tag, None) self.assertEquals(r["p2"].tag, "DC06") # prepare db r = VersionsDB.Release("R1") r.add(VersionsDB.Project("p1", "v1r0")) r.add(VersionsDB.Project("p2", "v1r0", tag="DC06")) test(self) # check XML generation xml = VersionsDB.generateXML() VersionsDB.loadString(xml) test(self)
def test_500_unversioned_projects(self): r = VersionsDB.Release("r1") r["a"] = "v1r0" r["b"] = "v1r0" r["c"] = "v1r0" VersionsDB.addUnversionedProject("u1") VersionsDB.addUnversionedProject("u2").addRunTimeDep("u1") r["b"].addRunTimeDep("u2") r["c"].addRunTimeDep("b") rtd = r.expandRunTimeDeps("c") rtd.sort() self.assertEquals(rtd, ["b", "u1", "u2"]) expected = [("b", "v1r0"), ("u1", ""), ("u2", "")] rtv = VersionsDB.getRuntimeVersions("c", "v1r0", "a") rtv.sort() self.assertEquals(rtv, expected) self.assertEquals([p.name for p in r.allProjects()], ["a", "u1", "u2", "b", "c"])
def test_010_create_release(self): ra = VersionsDB.Release("ReleaseA") rb = VersionsDB.Release("ReleaseB", base="ReleaseA") self.assertEqual(VersionsDB.getRelease("ReleaseA"), ra) self.assertEqual(VersionsDB.getRelease("ReleaseB"), rb) self.assertEquals(rb.base, "ReleaseA")
def test_040_missing_project(self): r = VersionsDB.Release("ReleaseA") r["Project1"] = "v1r0" r["Project2"] = "v2r0" self.assert_("Project3" not in r) self.assert_(not ("Project3" in r))