From 566000f684d8bb6db50a5609668ec04064f7008a Mon Sep 17 00:00:00 2001 From: Damien Nozay Date: Wed, 20 Mar 2019 22:30:41 -0700 Subject: [PATCH] fix for #189 --- tests/testsuite.py | 14 ++++++++++++++ xmlrunner/result.py | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/testsuite.py b/tests/testsuite.py index dcfb5eb..0b0cb7a 100755 --- a/tests/testsuite.py +++ b/tests/testsuite.py @@ -50,6 +50,20 @@ def validate_junit_report(text): JUnitSchema.assertValid(document) +class TestCaseSubclassWithNoSuper(unittest.TestCase): + def __init__(self, description): + # no super, see #189 + pass + + def run(self, result): + result = _XMLTestResult() + result.startTest(self) + result.stopTest(self) + + def test_something(self): + pass + + class DoctestTest(unittest.TestCase): def test_doctest_example(self): diff --git a/xmlrunner/result.py b/xmlrunner/result.py index 518f1c0..495402c 100644 --- a/xmlrunner/result.py +++ b/xmlrunner/result.py @@ -271,8 +271,8 @@ def startTest(self, test): # Handle partial and partialmethod objects. test_method = getattr(test_method, 'func', test_method) _, self.lineno = inspect.getsourcelines(test_method) - except TypeError: - # issue #188, some frameworks can make test method opaque. + except (AttributeError, TypeError): + # issue #188, #189, some frameworks can make test method opaque. pass if self.showAll: