def setUp(self):
        self.warnings = []
        mocked_warnings = Mock()
        mocked_warnings.addStdout = lambda l: self.warnings.append(l.rstrip())

        self.cook = []
        mocked_cook = Mock()
        mocked_cook.addStdout = lambda l: self.cook.append(l.rstrip())

        self.errors = []
        self.errors_stderr = []
        mocked_errors = Mock()
        mocked_errors.addStdout = \
            lambda l: self.errors.append(('o', l.rstrip()))
        mocked_errors.addStderr = \
            lambda l: self.errors.append(('e', l.rstrip()))

        self.unreal_log_observer = \
            UAT.BuildCookRunLogLineObserver(
                mocked_warnings, mocked_errors, mocked_cook)

        self.progress = {}
        self.unreal_log_observer.step = Mock()
        self.unreal_log_observer.step.setProgress = \
            lambda n, prog: self.progress.__setitem__(n, prog)
        self.maxDiff = None
 def createTest(self,
                extra_arguments=None,
                expected=SUCCESS,
                ending="bat",
                **kwargs):
     self.setupStep(
         UAT.BuildCookRun("Here", "There/Project.uproject", **kwargs))
     self.expectCommands(
         createExpectedShell(extra_arguments=extra_arguments,
                             ending=ending,
                             **kwargs))
     self.expectOutcome(result=expected)
     return self.runStep()
示例#3
0
    def setUp(self):
        self.setUpTestReactor()
        self.warnings = []
        mocked_warnings = Mock()
        mocked_warnings.addStdout = lambda l: self.warnings.append(l.rstrip())

        self.cook = []
        mocked_cook = Mock()
        mocked_cook.addStdout = lambda l: self.cook.append(l.rstrip())

        self.errors = []
        self.errors_stderr = []
        mocked_errors = Mock()
        mocked_errors.addStdout = \
            lambda l: self.errors.append(('o', l.rstrip()))
        mocked_errors.addStderr = \
            lambda l: self.errors.append(('e', l.rstrip()))

        self.unreal_log_observer = \
            UAT.BuildCookRunLogLineObserver()

        self.progress = {}
        self.unreal_log_observer.step = Mock()
        mockedLogs = {
            "warnings": mocked_warnings,
            "errors": mocked_errors,
            "cook": mocked_cook
        }

        def logReturner(logName):
            return mockedLogs.get(logName)

        self.unreal_log_observer.step.getLog = logReturner

        self.unreal_log_observer.step.setProgress = \
            lambda n, prog: self.progress.__setitem__(n, prog)
        self.maxDiff = None
def createBuildCommand(engine_path="Here",
                       project_path="There/Project.uproject",
                       **kwargs):
    return UAT.BuildCookRun(engine_path, project_path, **kwargs)