Skip to content

Remove reference to traceback object in _TestInfo.err Issue #105 #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions xmlrunner/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,23 @@ def __init__(self, test_result, test_method, outcome=SUCCESS, err=None, subTest=
self.test_result = test_result
self.outcome = outcome
self.elapsed_time = 0
self.err = err
self.test_exception_name = None
self.test_exception_message = None
if self.outcome != _TestInfo.SUCCESS:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if err ?

if self.outcome != _TestInfo.SKIP:
self.test_exception_name = safe_unicode(err[0].__name__)
self.test_exception_message = safe_unicode(err[1])
else:
self.test_exception_message = safe_unicode(err)

self.stdout = test_result._stdout_data
self.stderr = test_result._stderr_data

self.test_description = self.test_result.getDescription(test_method)
self.test_exception_info = (
'' if outcome in (self.SUCCESS, self.SKIP)
else self.test_result._exc_info_to_string(
self.err, test_method)
err, test_method)
)

self.test_name = testcase_name(test_method)
Expand Down Expand Up @@ -411,18 +419,18 @@ def _report_testcase(test_result, xml_testsuite, xml_document):
if test_result.outcome != _TestInfo.SKIP:
failure.setAttribute(
'type',
safe_unicode(test_result.err[0].__name__)
test_result.test_exception_name
)
failure.setAttribute(
'message',
safe_unicode(test_result.err[1])
test_result.test_exception_message
)
error_info = safe_unicode(test_result.get_error_info())
_XMLTestResult._createCDATAsections(
xml_document, failure, error_info)
else:
failure.setAttribute('type', 'skip')
failure.setAttribute('message', safe_unicode(test_result.err))
failure.setAttribute('message', test_result.test_exception_message)

_report_testcase = staticmethod(_report_testcase)

Expand Down