Beispiel #1
0
 def test_run_noFile(self):
     """
     If a file does not exit, fail with FILE_NOT_FOUND
     """
     b = FileBuild('hey')
     b.version = 'foo'
     
     def cb(build):
         self.assertEqual(build, b)
         self.assertEqual(build.status, FILE_NOT_FOUND)
     b.done.addCallback(cb)
     
     b.run()
     return b.done
Beispiel #2
0
 def test_run_noVersion(self):
     """
     If no version is supplied, the build will fail with MISSING_VERSION
     """
     f = FilePath(self.mktemp())
     f.setContent('#!/bin/bash\nexit 11')
     
     b = FileBuild(f)
     
     def cb(build):
         self.assertEqual(build, b)
         self.assertEqual(build.status, MISSING_VERSION)
     b.done.addCallback(cb)
     
     b.run()
     return b.done
Beispiel #3
0
 def test_version_passed(self):
     """
     The version should be passed to the underlying script
     """
     f = FilePath(self.mktemp())
     f.setContent('#!/bin/bash\nexit $1')
     
     b = FileBuild(f)
     b.version = '22'
     
     def cb(build):
         self.assertEqual(build, b)
         self.assertEqual(build.status, 22)
     b.done.addCallback(cb)
     
     b.run()
     return b.done
Beispiel #4
0
 def test_run(self):
     """
     Running should execute the given file.        
     """
     f = FilePath(self.mktemp())
     f.setContent('#!/bin/bash\nexit 12')
     
     b = FileBuild(f)
     b.version = 'foo'
     
     def cb(build):
         self.assertEqual(build, b)
         self.assertEqual(build.status, 12)
     b.done.addCallback(cb)
     
     b.run()
     return b.done
Beispiel #5
0
 def findBuilds(self, project, test_path=None):
     """
     Return a list of FileBuilds that match the given criteria
     """
     project_root = list(self._findHeads(project))
     if not project_root:
         return
     project_prefix = len(project_root[0].path) + 1
     
     heads = self._findHeads(project, test_path)
     for head in heads:
         for child in self._getChildFiles(head):
             # find test_path
             b = FileBuild(child)
             b.project = project
             b.test_path = child.path[project_prefix:]
             b.builder = self
             yield b