import pickle
import xml.sax.saxutils
-from config import config
-import helper
-import state
-import log
+from testlib.configuration import config
+import testlib.helper as helper
+import testlib.state as state
def _create_uid_index(iterable):
index = {}
self._metadata.result = result
@property
- def unsucessful(self):
+ def unsuccessful(self):
return self._metadata.result.value != state.Result.Passed
-class InternalTestResult(object, _CommonMetadataMixin):
+class InternalTestResult(_CommonMetadataMixin):
def __init__(self, obj, suite, directory):
self._metadata = obj.metadata
self.suite = suite
)
-class InternalSuiteResult(object, _CommonMetadataMixin):
+class InternalSuiteResult(_CommonMetadataMixin):
def __init__(self, obj, directory):
self._metadata = obj.metadata
self.directory = directory
return results
-class InternalLibraryResults(object, _CommonMetadataMixin):
+class InternalLibraryResults(_CommonMetadataMixin):
def __init__(self, obj, directory):
self.directory = directory
self._metadata = obj.metadata
if exc.errno != errno.EEXIST:
raise
- with open(path, 'w') as f:
+ with open(path, 'wb') as f:
pickle.dump(results, f, protocol)
@staticmethod
def load(path):
- with open(path, 'r') as f:
+ with open(path, 'rb') as f:
return pickle.load(f)
LargeFileElement('system-out', test_result.stdout),
]
+ if str(test_result.result) == 'Failed':
+ self.elements.append(JUnitFailure('Test failed', 'ERROR'))
+
+
+class JUnitFailure(XMLElement):
+ name = 'failure'
+ def __init__(self, message, fail_type):
+ self.attributes = [
+ XMLAttribute('message', message),
+ XMLAttribute('type', fail_type),
+ ]
+ self.elements = []
+
+
class LargeFileElement(XMLElement):
def __init__(self, name, filename):
self.name = name