def testDisabledCoreDumpsChannel(self): result = TestCaseResult() device = commons.FakeDevice() self.testResult._coreDumps.setEnabled(False) self.testResult.startTest(result, device) core = os.path.join(self._TEST_CORE_DIR, self._TEST_CORE_FILE) commons.createRandomSizeFile(core) self.testResult.stopTest(result, device) execResult = result.device(device) self.failIf(execResult.cores)
def testEnebledCoreDumpsChannel(self): result = TestCaseResult() device = commons.FakeDevice() self.testResult._coreDumps.setEnabled(True) self.testResult.startTest(result, device) core = os.path.join(self._TEST_CORE_DIR, self._TEST_CORE_FILE) commons.createRandomSizeFile(core) self.testResult.stopTest(result, device) execResult = result.device(device) self.failUnlessEqual(len(execResult.cores), 1) self.failUnless(core in execResult.cores)
def testMultipleChannelsLog(self): device = commons.FakeDevice() channels = [] for x in xrange(2): channel = commons.DummyChannel("Test_%d" % x, True) testresult.channels.scenario.append(channel) channels.append(channel) result = TestResult() result.start(None) caseResult = commons.DummyTestResult() caseResult.message = messageStart = "testStart" result.startTest(caseResult, device) caseResult.message = messageStop = "testStop" result.stopTest(caseResult, device) for channel in channels: self.assertEqual([messageStart, messageStop], channel.testBuffer)
def __init__(self, testResult, value): threading.Thread.__init__(self) self._testResult = testResult self._value = value self._device = commons.FakeDevice()