Esempio n. 1
0
    def updateTest(self, idx, test):
        """Update the information on one test in the test-list

        @type    idx: int
        @param     idx: The index of the test to change
        @type    test: pyTestCore.test.Test
        @param     test: The test to change
        """
        if test.state == TestState.Error:
            self.lstTests.CheckItem(idx, False)
            self.lstTests.SetItemBackgroundColour(idx, 'yellow')
        elif test.state == TestState.Success:
            self.lstTests.SetItemBackgroundColour(idx, 'green')
        elif test.state == TestState.Fail:
            self.lstTests.SetItemBackgroundColour(idx, 'red')
        elif test.state == TestState.Timeout:
            self.lstTests.SetItemBackgroundColour(idx, 'purple')
        elif test.state == TestState.Waiting:
            self.lstTests.SetItemBackgroundColour(idx, 'white')
        elif test.state == TestState.Disabled:
            self.lstTests.SetItemBackgroundColour(idx, 'gray')
        TermColor.active = False
        self.lstTests.SetStringItem(idx, 0, test.name)
        self.lstTests.SetStringItem(idx, 1, test.descr)
        self.lstTests.SetStringItem(idx, 2, TestState.toString(test.state))
Esempio n. 2
0
	def updateTest(self, idx, test):
		"""Update the information on one test in the test-list
		
		@type	idx: int
		@param 	idx: The index of the test to change
		@type	test: pyTestCore.test.Test
		@param 	test: The test to change
		"""
		if test.state == TestState.Error:
			self.lstTests.CheckItem(idx, False)
			self.lstTests.SetItemBackgroundColour(idx, 'yellow')
		elif test.state == TestState.Success:
			self.lstTests.SetItemBackgroundColour(idx, 'green')
		elif test.state == TestState.Fail:
			self.lstTests.SetItemBackgroundColour(idx, 'red')
		elif test.state == TestState.Timeout:
			self.lstTests.SetItemBackgroundColour(idx, 'purple')
		elif test.state == TestState.Waiting:
			self.lstTests.SetItemBackgroundColour(idx, 'white')
		elif test.state == TestState.Disabled:
			self.lstTests.SetItemBackgroundColour(idx, 'gray')
		TermColor.active = False
		self.lstTests.SetStringItem(idx, 0, test.name)
		self.lstTests.SetStringItem(idx, 1, test.descr)
		self.lstTests.SetStringItem(idx, 2, TestState.toString(test.state))
		TermColor.active = True
Esempio n. 3
0
    def run(self, quiet=False, tests=[]):
        """
        Runs the whole suite of tests

        @type    quiet: Boolean
        @param    quiet: Flag, passed along to the logger
        """
        self.success = 0
        self.failed = 0
        self.count = 0
        self.error = 0
        self.lastResult = TestState.Waiting
        for t in self._getTests(tests):
            self.lastResult = t.run()
            if t.descr is not None:
                logger.log("{}[{: 03}] {} - {}: {}".format(
                    TermColor.colorText("Test", TermColor.Purple), self.count,
                    t.name, t.descr, TestState.toString(t.state)))
            else:
                logger.log("{}[{: 03}] {}: {}".format(
                    TermColor.colorText("Test", TermColor.Purple), self.count,
                    t.name, TestState.toString(t.state)))
            if self.options['commands']:
                logger.log(" --> {}".format(t.cmd), showTime=False)
            logger.flush(quiet)
            if self.lastResult in [TestState.Success, TestState.Clean]:
                self.success += 1
            elif self.lastResult == TestState.Fail:
                self.failed += 1
            elif self.lastResult == TestState.Error:
                self.error += 1
            elif self.lastResult == TestState.Timeout:
                self.timedout += 1
            elif self.lastResult == TestState.SegFault:
                self.segfaults += 1
            elif self.lastResult == TestState.Assertion:
                self.assertions += 1
            self.count = self.count + 1
            yield t
            if self.lastResult != TestState.Disabled:
                if (self.mode == TestSuiteMode.BreakOnFail) and (
                        self.lastResult != TestState.Success):
                    break
                if (self.mode == TestSuiteMode.BreakOnError) and (
                        self.lastResult == TestState.Error):
                    break
        raise StopIteration()
Esempio n. 4
0
	def runOne(self, n):
		"""
		Run one single test
		
		@type	n: int
		@param	n: Number of the test
		"""
		if n < len(self):
			t = self.testList[n]
			self.lastResult = t.run()
			if t.descr is not None:
				logger.log("Test[{:02}] {} - {}: {}".format(n, t.name, t.descr, TestState.toString(t.state)))
			else:
				logger.log("Test[{:02}] {}: {}".format(n, t.name, TestState.toString(t.state)))
			return t
		else:
			logger.log("\tSorry but there is no test #{}".format(n))
			self.lastResult = TestState.Error
			return None
Esempio n. 5
0
	def runAll(self, quiet = False):
		"""
		Runs the whole suite of tests
		
		@type	quiet: Boolean
		@param	quiet: Flag, passed along to the logger
		"""
		self.success = 0
		self.failed = 0
		self.count = 0
		self.error = 0
		self.lastResult = TestState.Waiting
		for t in self.testList:
			self.count = self.count + 1 
			self.lastResult = t.run()
			if t.descr is not None:
				logger.log("Test[{:02}] {} - {}: {}".format(self.count, t.name, t.descr, TestState.toString(t.state)))
			else:
				logger.log("Test[{:02}] {}: {}".format(self.count, t.name, TestState.toString(t.state)))
			logger.flush(quiet)
			if self.lastResult == TestState.Success:
				self.success += 1
			elif self.lastResult == TestState.Fail:
				self.failed += 1
			elif self.lastResult == TestState.Error:
				self.error += 1
			elif self.lastResult == TestState.Timeout:
				self.timedout += 1
			elif self.lastResult == TestState.SegFault:
				self.segfaults += 1
			elif self.lastResult == TestState.Assertion:
				self.assertions += 1
			yield t
			if self.lastResult != TestState.Disabled:
				if (self.mode == TestSuiteMode.BreakOnFail) and (self.lastResult != TestState.Success):
					break
				if (self.mode == TestSuiteMode.BreakOnError) and (self.lastResult == TestState.Error):
					break
		raise StopIteration()
Esempio n. 6
0
    def run(self, quiet=False, tests=[]):
        """
        Runs the whole suite of tests

        @type    quiet: Boolean
        @param    quiet: Flag, passed along to the logger
        """
        self.success = 0
        self.failed = 0
        self.count = 0
        self.error = 0
        self.lastResult = TestState.Waiting
        for t in self._getTests(tests):
            self.lastResult = t.run()
            if t.descr is not None:
                logger.log("{}[{: 03}] {} - {}: {}".format(TermColor.colorText("Test", TermColor.Purple), self.count, t.name, t.descr, TestState.toString(t.state)))
            else:
                logger.log("{}[{: 03}] {}: {}".format(TermColor.colorText("Test", TermColor.Purple), self.count, t.name, TestState.toString(t.state)))
            if self.options['commands']:
                logger.log(" --> {}".format(t.cmd), showTime=False)
            logger.flush(quiet)
            if self.lastResult in [TestState.Success, TestState.Clean]:
                self.success += 1
            elif self.lastResult == TestState.Fail:
                self.failed += 1
            elif self.lastResult == TestState.Error:
                self.error += 1
            elif self.lastResult == TestState.Timeout:
                self.timedout += 1
            elif self.lastResult == TestState.SegFault:
                self.segfaults += 1
            elif self.lastResult == TestState.Assertion:
                self.assertions += 1
            self.count = self.count + 1
            yield t
            if self.lastResult != TestState.Disabled:
                if (self.mode == TestSuiteMode.BreakOnFail) and (self.lastResult != TestState.Success):
                    break
                if (self.mode == TestSuiteMode.BreakOnError) and (self.lastResult == TestState.Error):
                    break
        raise StopIteration()