oldani / HtmlTestRunner

A Test Runner in python, for Human Readable HTML Reports
MIT License
295 stars 171 forks source link

'TestResult' object has no attribute 'separator2' #63

Open joeymizrahi opened 4 years ago

joeymizrahi commented 4 years ago

Description

I am trying to define my own resultClass. This is because i need to do certain things when a unittest fails.

What I Did

import unittest
import HtmlTestRunner

if __name__ == '__main__':
    runner = HtmlTestRunner.HTMLTestRunner(resultclass=TestResult)
    unittest.main(testRunner=runner)

resulted in:

Traceback (most recent call last):
  File "*****", line 179, in <module>
    unittest.main(testRunner=runner)
  File "C:\Program Files\Python37\lib\unittest\main.py", line 101, in __init__
    self.runTests()
  File "C:\Program Files\Python37\lib\unittest\main.py", line 271, in runTests
    self.result = testRunner.run(self.test)
  File "C:\Program Files\Python37\lib\site-packages\HtmlTestRunner\runner.py", line 69, in run
    self.stream.writeln(result.separator2)
AttributeError: 'TestResult' object has no attribute 'separator2'
Alessandro-D commented 4 years ago

I am facing the same issue, as I am trying to pass a custom result class to display results through Zalenium.

is there any insight available?

joeymizrahi commented 4 years ago

I am facing the same issue, as I am trying to pass a custom result class to display results through Zalenium.

is there any insight available?

I never found any solutions, i ended up creating my own html report in an ugly way. would be happy to hear any ideas or solutions