Пример #1
0
    def test_DuplicateRuleError(self):

        build = Build()
        build.createRule('a.txt', FileTouchRule)

        with self.assertRaises(DuplicateRuleError):
            build.createRule('a.txt', FileTouchRule)
Пример #2
0
    def test_exists(self):
        touchFile('a.txt')

        build = Build()
        build.createRule('a.txt', FileTouchRule)

        build.build('a.txt')
        self.assertListEqual(build.trace, [])
Пример #3
0
    def test_DependentTargets_DNE(self):
        build = Build()
        a = build.createRule('a.txt', FileTouchRule)
        a.addPrerequisite('b.txt')

        build.createRule('b.txt', FileTouchRule)

        build.build('a.txt')
        self.assertListEqual(build.trace, [['b.txt'],['a.txt']])
Пример #4
0
    def test_IndependentTargets_DNE(self):
        build = Build()
        build.createRule('a.txt', FileTouchRule)
        build.createRule('b.txt', FileTouchRule)

        build.build('a.txt')
        self.assertListEqual(build.trace, [['a.txt']])

        build.build('b.txt')
        self.assertListEqual(build.trace, [['b.txt']])
Пример #5
0
    def test_MultipleTargers(self):
        build = Build()

        ab = build.createRule(['a.txt', 'b.txt'], FileTouchRule)
        ab.addPrerequisite('c.txt')

        cd = build.createRule(['c.txt', 'd.txt'], FileTouchRule)

        build.build('a.txt')
        self.assertListEqual(sortBuildTrace(build.trace), [['c.txt','d.txt'],['a.txt','b.txt']])
Пример #6
0
    def test_Tree_SubTreeDNE(self):
        touchFile('b.txt')

        build = Build()
        a = build.createRule('a.txt', FileTouchRule)
        a.addPrerequisite('b.txt')
        a.addPrerequisite('c.txt')

        build.createRule('b.txt', FileTouchRule)
        build.createRule('c.txt', FileTouchRule)

        build.build('a.txt')
        self.assertListEqual(build.trace, [['c.txt'],['a.txt']])
Пример #7
0
    def test_CyclicGraphError(self):

        build = Build()
        a = build.createRule('a.txt', FileTouchRule)
        a.addPrerequisite('b.txt')

        b = build.createRule('b.txt', FileTouchRule)
        b.addPrerequisite('c.txt')

        c = build.createRule('c.txt', FileTouchRule)
        c.addPrerequisite('a.txt')

        with self.assertRaises(CyclicGraphError):
            build.build('a.txt')
Пример #8
0
    def test_DependentTargets_BottomForceRebuild(self):
        touchFile('b.txt')
        touchFile('a.txt')

        build = Build()
        a = build.createRule('a.txt', FileTouchRule)
        a.addPrerequisite('b.txt')

        b = build.createRule('b.txt', FileTouchRule)
        b.setForceRebuild(True)


        build.build('a.txt')
        self.assertListEqual(build.trace, [['b.txt'], ['a.txt']])
Пример #9
0
    def test_Tree_TopNewer(self):
        touchFile('c.txt')
        touchFile('b.txt')
        touchFile('a.txt')

        build = Build()
        a = build.createRule('a.txt', FileTouchRule)
        a.addPrerequisite('b.txt')
        a.addPrerequisite('c.txt')

        build.createRule('b.txt', FileTouchRule)
        build.createRule('c.txt', FileTouchRule)

        build.build('a.txt')
        self.assertListEqual(build.trace, [])
Пример #10
0
    def test_NoSettingDefined(self):
        build = Build()

        setSetting(build,'b', 'b')
        touchFile('b.txt')
        touchFile('a.txt')

        a = build.createRule('a.txt', FileTouchRule)
        a.addPrerequisite('b.txt')
        a.addSetting('a')

        b = build.createRule('b.txt', FileTouchRule)
        b.addSetting('b')

        with self.assertRaises(NoSettingError):
            build.build('a.txt')
Пример #11
0
    def test_Line_BottomNewer(self):
        touchFile('b.txt')
        touchFile('a.txt')
        touchFile('c.txt')

        build = Build()
        a = build.createRule('a.txt', FileTouchRule)
        a.addPrerequisite('b.txt')

        b = build.createRule('b.txt', FileTouchRule)
        b.addPrerequisite('c.txt')

        build.createRule('c.txt', FileTouchRule)

        build.build('a.txt')
        self.assertListEqual(build.trace, [['b.txt'], ['a.txt']])
Пример #12
0
    def test_MissingPrerequisite(self):
        build = Build()
        a = build.createRule('a.txt', FileTouchRule)
        a.addPrerequisite('b.txt')

        with self.assertRaises(NoRuleError):
            build.build('a.txt')
Пример #13
0
    def test_TopSettingNewer(self):
        build = Build()

        setSetting(build,'b', 'b')
        touchFile('b.txt')
        touchFile('a.txt')
        setSetting(build,'a', 'a')

        a = build.createRule('a.txt', FileTouchRule)
        a.addPrerequisite('b.txt')
        a.addSetting('a')

        b = build.createRule('b.txt', FileTouchRule)
        b.addSetting('b')

        build.build('a.txt')
        self.assertListEqual(build.trace, [['a.txt']])
Пример #14
0
    def test_DNE(self):
        build = Build()
        build.createRule('a.txt', FileTouchRule)

        build.build('a.txt')
        self.assertListEqual(build.trace, [['a.txt']])