Exemple #1
0
    def testWrite(self):
        self.cf.setVersion("2.0", "Linux:rhel")
        self.assertEquals(len(self.cf.getFlavors()), 2)

        file = os.path.join(testEupsStack, "tst.current")
        self.cf.write(file)

        cf = ChainFile(file)
        self.assertEquals(cf.name, "fw")
        self.assertEquals(cf.tag, "current")
        flavors = cf.getFlavors()
        self.assertEquals(len(flavors), 2)
        self.assert_("DarwinX86" in flavors)

        flavor = cf.info["DarwinX86"]
        self.assertEquals(flavor['declarer'], 'rhl')
        self.assertEquals(flavor['modifier'], 'rhl')
        self.assertEquals(flavor['version'], 'svn3941')
        self.assertEquals(flavor['modified'], 'Thu Jan 24 23:43:35 2008')
        self.assertEquals(flavor['declared'], 'Thu Jan 24 23:43:35 2008')

        self.assert_("Linux:rhel" in flavors)
Exemple #2
0
    def testWrite(self):
        self.cf.setVersion("2.0", "Linux:rhel")
        self.assertEqual(len(self.cf.getFlavors()), 2)

        file=os.path.join(testEupsStack, "tst.current")
        self.cf.write(file)

        cf = ChainFile(file)
        self.assertEqual(cf.name, "fw")
        self.assertEqual(cf.tag, "current")
        flavors = cf.getFlavors()
        self.assertEqual(len(flavors), 2)
        self.assertIn("DarwinX86", flavors)

        flavor = cf.info["DarwinX86"]
        self.assertEqual(flavor['declarer'], 'rhl')
        self.assertEqual(flavor['modifier'], 'rhl')
        self.assertEqual(flavor['version'], 'svn3941')
        self.assertEqual(flavor['modified'], 'Thu Jan 24 23:43:35 2008')
        self.assertEqual(flavor['declared'], 'Thu Jan 24 23:43:35 2008')

        self.assertIn("Linux:rhel", flavors)
Exemple #3
0
class ChainFileTestCase(unittest.TestCase):
    def setUp(self):
        self.cf = ChainFile(os.path.join(testEupsStack, "fw.current"))

    def testParsing(self):
        self.assertEquals(self.cf.name, "fw")
        self.assertEquals(self.cf.tag, "current")
        flavors = self.cf.getFlavors()
        self.assertEquals(len(flavors), 1)
        self.assert_("DarwinX86" in flavors)

        flavor = self.cf.info["DarwinX86"]
        self.assertEquals(flavor['declarer'], 'rhl')
        self.assertEquals(flavor['modifier'], 'rhl')
        self.assertEquals(flavor['version'], 'svn3941')
        self.assertEquals(flavor['modified'], 'Thu Jan 24 23:43:35 2008')
        self.assertEquals(flavor['declared'], 'Thu Jan 24 23:43:35 2008')

        self.assertEquals(self.cf.getVersion("DarwinX86"), "svn3941")

        self.cf = ChainFile(os.path.join(testEupsStack, "fw.current"),
                            "afw",
                            "stable",
                            verbosity=-1)
        self.assertEquals(self.cf.name, "afw")
        self.assertEquals(self.cf.tag, "stable")
        flavors = self.cf.getFlavors()
        self.assertEquals(len(flavors), 1)

    def testSetVersion(self):
        self.cf.setVersion("2.0", "Linux")

        flavors = self.cf.getFlavors()
        self.assertEquals(len(flavors), 2)
        self.assert_("Linux" in flavors)

        flavor = self.cf.info["Linux"]
        self.assertEquals(flavor['version'], '2.0')
        self.assert_(bool(flavor['declarer']))
        self.assert_(bool(flavor['declared']))
        self.assert_(not flavor.has_key('modifier'))
        self.assert_(not flavor.has_key('modified'))
        who = flavor['declarer']

        self.cf.setVersion("2.1", "Linux64")

        flavors = self.cf.getFlavors()
        self.assertEquals(len(flavors), 3)
        self.assert_("Linux64" in flavors)

        flavor = self.cf.info["Linux64"]
        self.assertEquals(flavor['version'], '2.1')
        self.assertEquals(flavor['declarer'], who)
        self.assert_(bool(flavor['declared']))
        self.assert_(not flavor.has_key('modifier'))
        self.assert_(not flavor.has_key('modified'))

        # an update to an existing flavor
        self.cf.setVersion("2.1", "DarwinX86")

        flavors = self.cf.getFlavors()
        self.assertEquals(len(flavors), 3)
        self.assert_("DarwinX86" in flavors)

        flavor = self.cf.info["DarwinX86"]
        self.assertEquals(flavor['version'], '2.1')
        self.assertEquals(flavor['declarer'], 'rhl')
        self.assertEquals(flavor['declared'], 'Thu Jan 24 23:43:35 2008')
        self.assertEquals(flavor['modifier'], who)
        self.assert_(bool(flavor['modified']))

        self.cf.removeVersion("Linux64")
        flavors = self.cf.getFlavors()
        self.assertEquals(len(flavors), 2)
        self.assert_("DarwinX86" in flavors)
        self.assert_("Linux" in flavors)

        self.cf.removeVersion()
        flavors = self.cf.getFlavors()
        self.assertEquals(len(flavors), 0)

        self.assert_(self.cf.hasNoAssignments())

    def testWrite(self):
        self.cf.setVersion("2.0", "Linux:rhel")
        self.assertEquals(len(self.cf.getFlavors()), 2)

        file = os.path.join(testEupsStack, "tst.current")
        self.cf.write(file)

        cf = ChainFile(file)
        self.assertEquals(cf.name, "fw")
        self.assertEquals(cf.tag, "current")
        flavors = cf.getFlavors()
        self.assertEquals(len(flavors), 2)
        self.assert_("DarwinX86" in flavors)

        flavor = cf.info["DarwinX86"]
        self.assertEquals(flavor['declarer'], 'rhl')
        self.assertEquals(flavor['modifier'], 'rhl')
        self.assertEquals(flavor['version'], 'svn3941')
        self.assertEquals(flavor['modified'], 'Thu Jan 24 23:43:35 2008')
        self.assertEquals(flavor['declared'], 'Thu Jan 24 23:43:35 2008')

        self.assert_("Linux:rhel" in flavors)
Exemple #4
0
class ChainFileTestCase(unittest.TestCase):

    def setUp(self):
        self.cf = ChainFile(os.path.join(testEupsStack, "fw.current"))

    def testParsing(self):
        self.assertEqual(self.cf.name, "fw")
        self.assertEqual(self.cf.tag, "current")
        flavors = self.cf.getFlavors()
        self.assertEqual(len(flavors), 1)
        self.assertIn("DarwinX86", flavors)

        flavor = self.cf.info["DarwinX86"]
        self.assertEqual(flavor['declarer'], 'rhl')
        self.assertEqual(flavor['modifier'], 'rhl')
        self.assertEqual(flavor['version'], 'svn3941')
        self.assertEqual(flavor['modified'], 'Thu Jan 24 23:43:35 2008')
        self.assertEqual(flavor['declared'], 'Thu Jan 24 23:43:35 2008')

        self.assertEqual(self.cf.getVersion("DarwinX86"), "svn3941")

        self.cf = ChainFile(os.path.join(testEupsStack, "fw.current"),
                            "afw", "stable", verbosity=-1)
        self.assertEqual(self.cf.name, "afw")
        self.assertEqual(self.cf.tag, "stable")
        flavors = self.cf.getFlavors()
        self.assertEqual(len(flavors), 1)

    def testSetVersion(self):
        self.cf.setVersion("2.0", "Linux")

        flavors = self.cf.getFlavors()
        self.assertEqual(len(flavors), 2)
        self.assertIn("Linux", flavors)

        flavor = self.cf.info["Linux"]
        self.assertEqual(flavor['version'], '2.0')
        self.assert_(bool(flavor['declarer']))
        self.assert_(bool(flavor['declared']))
        self.assertNotIn('modifier', flavor)
        self.assertNotIn('modified', flavor)
        who = flavor['declarer']

        self.cf.setVersion("2.1", "Linux64")

        flavors = self.cf.getFlavors()
        self.assertEqual(len(flavors), 3)
        self.assertIn("Linux64", flavors)

        flavor = self.cf.info["Linux64"]
        self.assertEqual(flavor['version'], '2.1')
        self.assertEqual(flavor['declarer'], who)
        self.assert_(bool(flavor['declared']))
        self.assertNotIn('modifier', flavor)
        self.assertNotIn('modified', flavor)

        # an update to an existing flavor
        self.cf.setVersion("2.1", "DarwinX86")

        flavors = self.cf.getFlavors()
        self.assertEqual(len(flavors), 3)
        self.assertIn("DarwinX86", flavors)

        flavor = self.cf.info["DarwinX86"]
        self.assertEqual(flavor['version'], '2.1')
        self.assertEqual(flavor['declarer'], 'rhl')
        self.assertEqual(flavor['declared'], 'Thu Jan 24 23:43:35 2008')
        self.assertEqual(flavor['modifier'], who)
        self.assert_(bool(flavor['modified']))

        self.cf.removeVersion("Linux64")
        flavors = self.cf.getFlavors()
        self.assertEqual(len(flavors), 2)
        self.assertIn("DarwinX86", flavors)
        self.assertIn("Linux", flavors)

        self.cf.removeVersion()
        flavors = self.cf.getFlavors()
        self.assertEqual(len(flavors), 0)

        self.assert_(self.cf.hasNoAssignments())

    def testWrite(self):
        self.cf.setVersion("2.0", "Linux:rhel")
        self.assertEqual(len(self.cf.getFlavors()), 2)

        file=os.path.join(testEupsStack, "tst.current")
        self.cf.write(file)

        cf = ChainFile(file)
        self.assertEqual(cf.name, "fw")
        self.assertEqual(cf.tag, "current")
        flavors = cf.getFlavors()
        self.assertEqual(len(flavors), 2)
        self.assertIn("DarwinX86", flavors)

        flavor = cf.info["DarwinX86"]
        self.assertEqual(flavor['declarer'], 'rhl')
        self.assertEqual(flavor['modifier'], 'rhl')
        self.assertEqual(flavor['version'], 'svn3941')
        self.assertEqual(flavor['modified'], 'Thu Jan 24 23:43:35 2008')
        self.assertEqual(flavor['declared'], 'Thu Jan 24 23:43:35 2008')

        self.assertIn("Linux:rhel", flavors)