Example #1
0
    def test_dirIsIncluded(self):
        myDef = Definition('myName', 'dir', 'C:/temp', './C/temp', [], [], [],
                           [])
        self.assert_(myDef._dirIsIncluded('anydir'),
                     'Dir not included on empty include list')

        myDef.includeDirPattern = ['asd*', 'path']
        self.assert_(myDef._dirIsIncluded('path'),
                     'Dir not included that is in include list')
        self.assert_(myDef._dirIsIncluded('asd_whatEverDir'),
                     'Dir not included that is in include list2')
        self.assert_(not myDef._dirIsIncluded('anydir'),
                     'Dir included when not in include list')
Example #2
0
    def testfileInfos(self):
        Environment.cleanupTestFolder()
        exampleFile = Environment.setupExamplesDir()

        myDef = Definition('Name1', 'dir', Environment.examplesFolder(),
                           'Test/Dir')

        infos = []
        for info in myDef.fileInfos():
            infos.append(info)

        self.assert_(infos <> None, 'No fileInfos created')
        self.assert_(
            infos[0]['source'] == os.path.join(Environment.examplesFolder(),
                                               'example.txt'),
            'Example source file not OK')
        self.assert_(
            infos[0]['target'] == os.path.join('Test/Dir', 'examples',
                                               'example.txt'),
            'Example source file not OK')

        someFiles = Environment.extendExamplesDir()
        someFiles.append(exampleFile)

        infos = []
        for info in myDef.fileInfos():
            infos.append(info)

        self.assert_(len(infos) == len(someFiles), 'Not all files found')

        myDef.includeDirPattern = ['subfolder']

        infos = []
        for info in myDef.fileInfos():
            infos.append(info)
        # Note that I get all files of the base dir, independent if that matches included dirrs!
        self.assert_(len(infos) == 4, 'Nb of files not OK for include dirs')

        Environment.cleanupTestFolder()