Exemplo n.º 1
0
class TestRule(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.name = 'rulenametest'
        self.description = 'this is message text'
        self.command = ['cat foo | grep']
        self.depfile = 'output.d'

        self.example_rule = { 'name' : self.name,
                              'description': self.description,
                              'command': self.command,
                              'depfile': self.depfile }
             
    def test_rule_return(self):
        self.r.name(self.name)
        self.r.description(self.description)
        self.r.command(self.command)
        rule = self.r.rule()

        self.assertEqual(type(rule), type(self.example_rule))

    def test_rule_has_keys(self):
        self.r.name(self.name)
        self.r.description(self.description)
        self.r.command(self.command)
        self.r.depfile(self.depfile)
        rule = self.r.rule()

        self.assertEqual(rule.keys(), self.example_rule.keys())
Exemplo n.º 2
0
class TestRule(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.name = 'rulenametest'
        self.description = 'this is message text'
        self.command = ['cat foo | grep']
        self.depfile = 'output.d'

        self.example_rule = {
            'name': self.name,
            'description': self.description,
            'command': self.command,
            'depfile': self.depfile
        }

    def test_rule_return(self):
        self.r.name(self.name)
        self.r.description(self.description)
        self.r.command(self.command)
        rule = self.r.rule()

        self.assertEqual(type(rule), type(self.example_rule))

    def test_rule_has_keys(self):
        self.r.name(self.name)
        self.r.description(self.description)
        self.r.command(self.command)
        self.r.depfile(self.depfile)
        rule = self.r.rule()

        self.assertEqual(rule.keys(), self.example_rule.keys())
Exemplo n.º 3
0
class TestRuleDepFile(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.depfile = 'output.d'

    def test_depfile_return_value(self):
        self.assertTrue(self.r.depfile(self.depfile))
 
    def test_depfile_helper(self):
        self.r.depfile(self.depfile)
        self.assertEqual(self.depfile , self.r._rule['depfile'])

    def test_default_depfile_state(self):
        with self.assertRaises(KeyError):
            self.r.depfile()

    def test_depfile_return_helper(self):
        self.r.depfile(self.depfile)
        self.assertEqual(self.depfile , self.r.depfile())
Exemplo n.º 4
0
class TestRuleDepFile(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.depfile = 'output.d'

    def test_depfile_return_value(self):
        self.assertTrue(self.r.depfile(self.depfile))

    def test_depfile_helper(self):
        self.r.depfile(self.depfile)
        self.assertEqual(self.depfile, self.r._rule['depfile'])

    def test_default_depfile_state(self):
        with self.assertRaises(KeyError):
            self.r.depfile()

    def test_depfile_return_helper(self):
        self.r.depfile(self.depfile)
        self.assertEqual(self.depfile, self.r.depfile())