Skip to content

TypeError raised when a subtest ends successfully #85

@arugifa

Description

@arugifa

When a subtest ends, the method result.addSubTest is called, even when no error is encountered. A TypeError is then raised, because the error is None. Here is the end of the stacktrace:

File "/opt/python-3.4.2/lib/python3.4/unittest/case.py", line 513, in _feedErrorsToResult
    result.addSubTest(test.test_case, test, exc_info)
File "/home/jenkins/venv/0/lib/python3.4/site-packages/xmlrunner/result.py", line 245, in addSubTest
    testinfo = _TestInfo(self, testcase, _TestInfo.ERROR, err, subTest=test)
File "/home/jenkins/venv/0/lib/python3.4/site-packages/xmlrunner/result.py", line 102, in __init__
    self.err, test_method)
File "/opt/python-3.4.2/lib/python3.4/unittest/result.py", line 173, in _exc_info_to_string
    exctype, value, tb = err
TypeError: 'NoneType' object is not iterable

Hence, the error must be converted to string only if it is not None (https://hg.python.org/cpython/file/0be7c8f46378/Lib/unittest/result.py#l127).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions