Example #1
0
    def test_runTestPackage_compileOnly(self):
        results = runTestPackage(SINGLE_MAKE_FILE,
                                 MAKE_ARGUMENTS,
                                 shallRun=False,
                                 shallBeVerbose=True)

        expected = [
            call(SINGLE_MAKE_FILE, MAKE_ARGUMENTS, True),
            call().compile()
        ]
        self.assertCalls(self.testsRunner, expected)
        self.assertEqual((SINGLE_MAKE_FILE, 'PASSED', ''), results)
Example #2
0
    def test_runTestPackage_withExceptionUponInitialization(self):
        exception = Exception(
            "This is an emulation of exception upon makefile processing")

        def initFakeRunner(*args, **kwargs):
            raise exception

        self.testsRunner.side_effect = initFakeRunner

        results = runTestPackage(SINGLE_MAKE_FILE,
                                 MAKE_ARGUMENTS,
                                 shallRun=True,
                                 shallBeVerbose=True)

        expected = [call(SINGLE_MAKE_FILE, MAKE_ARGUMENTS, True)]
        self.assertCalls(self.testsRunner, expected)
        self.assertEqual(
            (SINGLE_MAKE_FILE, 'CRASHED',
             MAKEFILE_CORRUPTION.format(filename=SINGLE_MAKE_FILE,
                                        exception=str(exception))), results)
Example #3
0
    def test_runTestPackage_withAbnormalTestException(self):
        exception = "This is abnormal exception emulation"

        def fakeRunMethod():
            raise Exception(exception)

        self.testsRunner.return_value.run.side_effect = fakeRunMethod

        results = runTestPackage(SINGLE_MAKE_FILE,
                                 MAKE_ARGUMENTS,
                                 shallRun=True,
                                 shallBeVerbose=True)

        expected = [
            call(SINGLE_MAKE_FILE, MAKE_ARGUMENTS, True),
            call().compile(),
            call().run(),
            call().writeLog(exception)
        ]
        self.assertCalls(self.testsRunner, expected)
        self.assertEqual((SINGLE_MAKE_FILE, 'CRASHED', exception), results)
Example #4
0
    def test_runTestPackage_withTestException(self):
        exception = "Fake exception to test error-handling"

        def fakeRunMethod():
            raise TestsRunnerException(exception)

        self.testsRunner.return_value.run.side_effect = fakeRunMethod

        results = runTestPackage(SINGLE_MAKE_FILE,
                                 MAKE_ARGUMENTS,
                                 shallRun=True,
                                 shallBeVerbose=True)

        expected = [
            call(SINGLE_MAKE_FILE, MAKE_ARGUMENTS, True),
            call().compile(),
            call().run(),
            call().writeLog(exception)
        ]
        self.assertCalls(self.testsRunner, expected)
        self.assertEqual((SINGLE_MAKE_FILE, 'FAILED', exception), results)