Skip to content

Commit

Permalink
Pass through arguments for TextTestRunner with **kwargs
Browse files Browse the repository at this point in the history
* This ensures `XMLTestRunner.__init__` compatible with `TextTestRunner.__init__`.
  • Loading branch information
ikedam authored and dnozay committed May 18, 2018
1 parent a87ba64 commit 79621f3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions xmlrunner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ class XMLTestRunner(TextTestRunner):
"""
A test runner class that outputs the results in JUnit like XML files.
"""
def __init__(self, output='.', outsuffix=None, stream=sys.stderr,
descriptions=True, verbosity=1, elapsed_times=True,
failfast=False, buffer=False, encoding=UTF8,
resultclass=None):
TextTestRunner.__init__(self, stream, descriptions, verbosity,
failfast=failfast, buffer=buffer)
self.verbosity = verbosity
def __init__(self, output='.', outsuffix=None,
elapsed_times=True, encoding=UTF8,
resultclass=None,
**kwargs):
super(XMLTestRunner, self).__init__(**kwargs)
self.output = output
self.encoding = encoding
# None means default timestamped suffix
Expand Down

1 comment on commit 79621f3

@echobravo2
Copy link

Choose a reason for hiding this comment

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

this works fine for python2
as for python3 when initialyzing resultclass to my Abstract runner we get an exception:

-> runner = xmlrunner.XMLTestRunner(output=xml_dir, verbosity=2, resultclass=AbstractXmlRunnerTestCase.TestResultForRunner)
(Pdb) s
TypeError: init() got an unexpected keyword argument 'resultclass'

the init() in python3 don't have resultclass property, and python2 runner.py + result.py classes are both in xmlrunner.py

Please sign in to comment.