def testProd1(self):
        pname = "newprod"
        pver = "2.0"
        pdir = os.path.join(self.eupsPathDir,"Linux",pname,pver)
        prod = Product("newprod", "2.0", "Linux", pdir, db=self.dbpath)

        self.assertEqual(prod.dir, pdir)
        self.assertEqual(prod.db, self.dbpath)
        self.assert_(prod.ups_dir is None)
        self.assert_(prod.tablefile is None)
        self.assertEqual(prod.tableFileName(),
                          os.path.join(pdir,"ups",pname+".table"))

        # test cloning (we'll use this later)
        clone = prod.clone()
        self.assertEqual(clone.dir, pdir)
        self.assertEqual(clone.db, self.dbpath)
        self.assert_(clone.ups_dir is None)
        self.assert_(clone.tablefile is None)
        self.assertEqual(clone.tableFileName(),
                          os.path.join(pdir,"ups",pname+".table"))

        # turn to absolute paths
        prod.resolvePaths()
        self.assertEqual(prod.dir, pdir)
        self.assertEqual(prod.db, self.dbpath)
        self.assertEqual(prod.tablefile,
                          os.path.join(pdir,"ups",pname+".table"))
        self.assertEqual(prod.ups_dir, os.path.join(pdir,"ups"))
        self.assertEqual(prod.tableFileName(),
                          os.path.join(pdir,"ups",pname+".table"))

        # turn to relative paths
        prod.canonicalizePaths()
        self.assertEqual(prod.dir, "Linux/newprod/2.0")
        self.assertEqual(prod.db, self.dbpath)
        self.assertEqual(prod.tablefile, pname+".table")
        self.assertEqual(prod.ups_dir, "ups")
        self.assertEqual(prod.tableFileName(),
                          os.path.join(pdir,"ups",pname+".table"))

        # round trip: turn back to absolute paths
        prod.resolvePaths()
        self.assertEqual(prod.dir, pdir)
        self.assertEqual(prod.db, self.dbpath)
        self.assertEqual(prod.tablefile,
                          os.path.join(pdir,"ups",pname+".table"))
        self.assertEqual(prod.ups_dir, os.path.join(pdir,"ups"))
        self.assertEqual(prod.tableFileName(),
                          os.path.join(pdir,"ups",pname+".table"))

        # turn original to relative paths
        clone.canonicalizePaths()
        self.assertEqual(clone.dir, "Linux/newprod/2.0")
        self.assertEqual(clone.db, self.dbpath)
        self.assertEqual(clone.tablefile, pname+".table")
        self.assertEqual(clone.ups_dir, "ups")
        self.assertEqual(clone.tableFileName(),
                          os.path.join(pdir,"ups",pname+".table"))

        # back to absolute paths
        clone.resolvePaths()
        self.assertEqual(clone.dir, pdir)
        self.assertEqual(clone.db, self.dbpath)
        self.assertEqual(clone.tablefile,
                          os.path.join(pdir,"ups",pname+".table"))
        self.assertEqual(clone.ups_dir, os.path.join(pdir,"ups"))
        self.assertEqual(clone.tableFileName(),
                          os.path.join(pdir,"ups",pname+".table"))
Exemple #2
0
    def testProd1(self):
        pname = "newprod"
        pver = "2.0"
        pdir = os.path.join(self.eupsPathDir, "Linux", pname, pver)
        prod = Product("newprod", "2.0", "Linux", pdir, db=self.dbpath)

        self.assertEqual(prod.dir, pdir)
        self.assertEqual(prod.db, self.dbpath)
        self.assert_(prod.ups_dir is None)
        self.assert_(prod.tablefile is None)
        self.assertEqual(prod.tableFileName(),
                         os.path.join(pdir, "ups", pname + ".table"))

        # test cloning (we'll use this later)
        clone = prod.clone()
        self.assertEqual(clone.dir, pdir)
        self.assertEqual(clone.db, self.dbpath)
        self.assert_(clone.ups_dir is None)
        self.assert_(clone.tablefile is None)
        self.assertEqual(clone.tableFileName(),
                         os.path.join(pdir, "ups", pname + ".table"))

        # turn to absolute paths
        prod.resolvePaths()
        self.assertEqual(prod.dir, pdir)
        self.assertEqual(prod.db, self.dbpath)
        self.assertEqual(prod.tablefile,
                         os.path.join(pdir, "ups", pname + ".table"))
        self.assertEqual(prod.ups_dir, os.path.join(pdir, "ups"))
        self.assertEqual(prod.tableFileName(),
                         os.path.join(pdir, "ups", pname + ".table"))

        # turn to relative paths
        prod.canonicalizePaths()
        self.assertEqual(prod.dir, "Linux/newprod/2.0")
        self.assertEqual(prod.db, self.dbpath)
        self.assertEqual(prod.tablefile, pname + ".table")
        self.assertEqual(prod.ups_dir, "ups")
        self.assertEqual(prod.tableFileName(),
                         os.path.join(pdir, "ups", pname + ".table"))

        # round trip: turn back to absolute paths
        prod.resolvePaths()
        self.assertEqual(prod.dir, pdir)
        self.assertEqual(prod.db, self.dbpath)
        self.assertEqual(prod.tablefile,
                         os.path.join(pdir, "ups", pname + ".table"))
        self.assertEqual(prod.ups_dir, os.path.join(pdir, "ups"))
        self.assertEqual(prod.tableFileName(),
                         os.path.join(pdir, "ups", pname + ".table"))

        # turn original to relative paths
        clone.canonicalizePaths()
        self.assertEqual(clone.dir, "Linux/newprod/2.0")
        self.assertEqual(clone.db, self.dbpath)
        self.assertEqual(clone.tablefile, pname + ".table")
        self.assertEqual(clone.ups_dir, "ups")
        self.assertEqual(clone.tableFileName(),
                         os.path.join(pdir, "ups", pname + ".table"))

        # back to absolute paths
        clone.resolvePaths()
        self.assertEqual(clone.dir, pdir)
        self.assertEqual(clone.db, self.dbpath)
        self.assertEqual(clone.tablefile,
                         os.path.join(pdir, "ups", pname + ".table"))
        self.assertEqual(clone.ups_dir, os.path.join(pdir, "ups"))
        self.assertEqual(clone.tableFileName(),
                         os.path.join(pdir, "ups", pname + ".table"))
    def testProd2(self):
        """
        Test $UPS_DB transformations
        """
        pname = "newprod"
        pver = "2.0"
        pdir = os.path.join(self.eupsPathDir,"Linux",pname,pver)
        prod = Product("newprod", "2.0", "Linux", pdir, db=self.dbpath,
                       table=os.path.join(self.dbpath,pname,'Linux',
                                          pver+".table"))

        self.assertEqual(prod.dir, pdir)
        self.assertEqual(prod.db, self.dbpath)
        self.assertEqual(prod.tablefile,
                          os.path.join(self.dbpath,"newprod/Linux/2.0.table"))
        self.assert_(prod.ups_dir is None)
        self.assertEqual(prod.tableFileName(),
                          os.path.join(self.dbpath,"newprod/Linux/2.0.table"))

        # test cloning (we'll use this later)
        clone = prod.clone()
        self.assertEqual(clone.dir, pdir)
        self.assertEqual(clone.db, self.dbpath)
        self.assertEqual(clone.tablefile,
                          os.path.join(self.dbpath,"newprod/Linux/2.0.table"))
        self.assert_(clone.ups_dir is None)
        self.assertEqual(clone.tableFileName(),
                          os.path.join(self.dbpath,"newprod/Linux/2.0.table"))

        # turn to absolute paths
        prod.resolvePaths()
        self.assertEqual(prod.dir, pdir)
        self.assertEqual(prod.db, self.dbpath)
        self.assert_(prod.ups_dir is None)
        self.assertEqual(prod.tablefile,
                          os.path.join(self.dbpath,"newprod/Linux/2.0.table"))
        self.assertEqual(prod.tableFileName(),
                          os.path.join(self.dbpath,"newprod/Linux/2.0.table"))

        prod.canonicalizePaths()
        self.assertEqual(prod.dir, "Linux/newprod/2.0")
        self.assertEqual(prod.db, self.dbpath)
        self.assertEqual(prod.ups_dir, "$UPS_DB/newprod/Linux")
        self.assertEqual(prod.tablefile, "2.0.table")
        self.assertEqual(prod.tableFileName(),
                          os.path.join(self.dbpath,"newprod/Linux/2.0.table"))

        # turn original to relative paths
        clone.canonicalizePaths()
        self.assertEqual(clone.dir, "Linux/newprod/2.0")
        self.assertEqual(clone.db, self.dbpath)
        self.assertEqual(clone.ups_dir, "$UPS_DB/newprod/Linux")
        self.assertEqual(clone.tablefile, "2.0.table")
        self.assertEqual(clone.tableFileName(),
                          os.path.join(self.dbpath,"newprod/Linux/2.0.table"))

        # back to absolute paths
        clone.resolvePaths()
        self.assertEqual(clone.dir, pdir)
        self.assertEqual(clone.db, self.dbpath)
        self.assertEqual(clone.ups_dir,
                          os.path.join(self.dbpath,pname,"Linux"))
        self.assertEqual(clone.tablefile,
                          os.path.join(self.dbpath,"newprod/Linux/2.0.table"))
        self.assertEqual(clone.tableFileName(),
                          os.path.join(self.dbpath,"newprod/Linux/2.0.table"))
Exemple #4
0
    def testProd2(self):
        """
        Test $UPS_DB transformations
        """
        pname = "newprod"
        pver = "2.0"
        pdir = os.path.join(self.eupsPathDir, "Linux", pname, pver)
        prod = Product("newprod",
                       "2.0",
                       "Linux",
                       pdir,
                       db=self.dbpath,
                       table=os.path.join(self.dbpath, pname, 'Linux',
                                          pver + ".table"))

        self.assertEqual(prod.dir, pdir)
        self.assertEqual(prod.db, self.dbpath)
        self.assertEqual(prod.tablefile,
                         os.path.join(self.dbpath, "newprod/Linux/2.0.table"))
        self.assert_(prod.ups_dir is None)
        self.assertEqual(prod.tableFileName(),
                         os.path.join(self.dbpath, "newprod/Linux/2.0.table"))

        # test cloning (we'll use this later)
        clone = prod.clone()
        self.assertEqual(clone.dir, pdir)
        self.assertEqual(clone.db, self.dbpath)
        self.assertEqual(clone.tablefile,
                         os.path.join(self.dbpath, "newprod/Linux/2.0.table"))
        self.assert_(clone.ups_dir is None)
        self.assertEqual(clone.tableFileName(),
                         os.path.join(self.dbpath, "newprod/Linux/2.0.table"))

        # turn to absolute paths
        prod.resolvePaths()
        self.assertEqual(prod.dir, pdir)
        self.assertEqual(prod.db, self.dbpath)
        self.assert_(prod.ups_dir is None)
        self.assertEqual(prod.tablefile,
                         os.path.join(self.dbpath, "newprod/Linux/2.0.table"))
        self.assertEqual(prod.tableFileName(),
                         os.path.join(self.dbpath, "newprod/Linux/2.0.table"))

        prod.canonicalizePaths()
        self.assertEqual(prod.dir, "Linux/newprod/2.0")
        self.assertEqual(prod.db, self.dbpath)
        self.assertEqual(prod.ups_dir, "$UPS_DB/newprod/Linux")
        self.assertEqual(prod.tablefile, "2.0.table")
        self.assertEqual(prod.tableFileName(),
                         os.path.join(self.dbpath, "newprod/Linux/2.0.table"))

        # turn original to relative paths
        clone.canonicalizePaths()
        self.assertEqual(clone.dir, "Linux/newprod/2.0")
        self.assertEqual(clone.db, self.dbpath)
        self.assertEqual(clone.ups_dir, "$UPS_DB/newprod/Linux")
        self.assertEqual(clone.tablefile, "2.0.table")
        self.assertEqual(clone.tableFileName(),
                         os.path.join(self.dbpath, "newprod/Linux/2.0.table"))

        # back to absolute paths
        clone.resolvePaths()
        self.assertEqual(clone.dir, pdir)
        self.assertEqual(clone.db, self.dbpath)
        self.assertEqual(clone.ups_dir,
                         os.path.join(self.dbpath, pname, "Linux"))
        self.assertEqual(clone.tablefile,
                         os.path.join(self.dbpath, "newprod/Linux/2.0.table"))
        self.assertEqual(clone.tableFileName(),
                         os.path.join(self.dbpath, "newprod/Linux/2.0.table"))