Bug 1323770 - Moztest should forward correct test result. r=ahal

Registered callback handlers for tests should receive the correct
test status when the test has been finished, and not always "Error".

This change allows those callbacks to run specific code for individual
test results, eg. only do screenshots for failures.

MozReview-Commit-ID: FfbCRR0Jvjb

--HG--
extra : rebase_source : c73253acbb666ca62b23f806145c20f0a70c934c
This commit is contained in:
Henrik Skupin 2016-12-21 11:19:36 +01:00
Родитель 1fbe2eb916
Коммит 3b00d747cb
2 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -134,7 +134,7 @@ class StructuredTestResult(TextTestResult):
extra=extra)
def addFailure(self, test, err):
extra = self.call_callbacks(test, "ERROR")
extra = self.call_callbacks(test, "FAIL")
extra.update(self._get_class_method_name(test))
self.logger.test_end(test.id(),
"FAIL",
@ -145,10 +145,13 @@ class StructuredTestResult(TextTestResult):
def addSuccess(self, test):
extra = self._get_class_method_name(test)
self.logger.test_end(test.id(), "PASS", expected="PASS", extra=extra)
self.logger.test_end(test.id(),
"PASS",
expected="PASS",
extra=extra)
def addExpectedFailure(self, test, err):
extra = self.call_callbacks(test, "ERROR")
extra = self.call_callbacks(test, "FAIL")
extra.update(self._get_class_method_name(test))
self.logger.test_end(test.id(),
"FAIL",
@ -158,7 +161,7 @@ class StructuredTestResult(TextTestResult):
extra=extra)
def addUnexpectedSuccess(self, test):
extra = self.call_callbacks(test, "ERROR")
extra = self.call_callbacks(test, "PASS")
extra.update(self._get_class_method_name(test))
self.logger.test_end(test.id(),
"PASS",
@ -166,7 +169,7 @@ class StructuredTestResult(TextTestResult):
extra=extra)
def addSkip(self, test, reason):
extra = self.call_callbacks(test, "ERROR")
extra = self.call_callbacks(test, "SKIP")
extra.update(self._get_class_method_name(test))
self.logger.test_end(test.id(),
"SKIP",

Просмотреть файл

@ -4,7 +4,7 @@
from setuptools import setup, find_packages
PACKAGE_VERSION = '0.7'
PACKAGE_VERSION = '0.8'
# dependencies
deps = ['mozinfo']