-
Notifications
You must be signed in to change notification settings - Fork 333
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
Is it Python 3.2 Compatible ? #1
Comments
Good question. HTMLTestRunner date back to 2005 and has not been ported to Python 3. This is an excellent request to work on. Unicode handling was a mess back in the old days (Python 2.4?). I am looking forward for easier time in Python 3. |
hi |
No it have not been updated in a long time. |
Hi Wai, I was using your module HTMLTestRunner.py for generating report with selenium 2.35.0 and python 2.7 and it was working fine. Now i upgraded python 2 to python 3 and selenium 2.35.0 to selenium 2.43.0, now i am able to run my test cases but it is not generating report. Kindly let me know have you added support for python 3. Thanks, |
Hi Wai, Thanks, |
I'm not able to spend any time on this project. If anyone can kindly continue the development it will be much appreciated. |
I made some small changes to your project and it now works for me (with python 3.4), although probably the changes are not decent enough. |
@ElaineAng Could you please tell me about changes that you made in this module which worked for you.It would be of great help to me. |
@SulakshnaDas Hi, sorry for the late reply. I am a beginner on python so I don't know whether the changes I made is decent. I was using code from his website, which seems to have slight (and unimportant) difference from the code in the github here. website URL: http://tungwaiyip.info/software/HTMLTestRunner_0_8_2/HTMLTestRunner.py The changes that I made: Line 94: from io import * Line 538, in method startTest(self,test): self.outputBuffer=StringIO() Line 631, in method run(self,test): print ("\nTime Elapsed: %s" %(self.stopTime-self.startTime), In method _generate_report_test(self,rows,cid,tid,n,t,o,e): Hopefully it helps... |
In 3.x it is no longer StringIO. Here are the changes that I made to get it to work for 3.4 Line 94: import io as StringIO Line 63: print('Time Elapsed: {}'.format((self.stopTime-self.startTime)), file=sys.stderr) in the methoid __generate_report_test: change all the decodes to: uo = bytes(o, 'utf-8').decode('latin-1') (or ue and e) |
Correction from above : Itls line 632. |
to work with 3.x """ The simplest way to use this is to invoke its main method. E.g.
For more customization options, instantiates a HTMLTestRunner object.
Copyright (c) 2004-2007, Wai Yip Tung Redistribution and use in source and binary forms, with or without
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS URL: http://tungwaiyip.info/software/HTMLTestRunner.htmlauthor = "Wai Yip Tung" """ Version 0.8.2
Version in 0.8.1
Version in 0.8.0
Version in 0.7.1
TODO: color stderrTODO: simplify javascript using ,ore than 1 class in the class attribute?import datetime ------------------------------------------------------------------------The redirectors below are used to capture output during testing. Outputsent to sys.stdout and sys.stderr are automatically captured. Howeverin some cases sys.stdout is already cached before HTMLTestRunner isinvoked (e.g. calling logging.basicConfig). In order to capture thoseoutput, use the redirectors for the cached stream.e.g.>>> logging.basicConfig(stream=HTMLTestRunner.stdout_redirector)>>>class OutputRedirector(object):
stdout_redirector = OutputRedirector(sys.stdout) ----------------------------------------------------------------------Templateclass Template_mixin(object):
|
You may want to use the fork available at https://github.com/dash0002/HTMLTestRunner which is ready for Python 3. |
You can use the fork https://github.com/dheerajalim/HTMLTestRunner |
hI, none of these solutions work with python 3.5.2 . If I used solution of @dheerajalim I have got such errors:
If I used solution of @dash0002 I got such errors:
|
Quick double check @Akopov4; With the version available from @dheerajalim or @dash0002 it works in 3.5.1, but in 3.5.2 you receive this error? |
Hi Akop,
It says
TypeError: write() argument must be str, not bytes
Can you try changing 'wb' to 'w'.
That should solve this!
…On Mar 19, 2017 10:19 AM, "Akop Akopov" ***@***.***> wrote:
hI, none of these solutions work with python 3.5.2 . If I used solution of
@dheerajalim <https://github.com/dheerajalim> I have got such errors:
File "/home/akop/py_workspace/setest/2/smoketests_with_html_report.py", line 26, in <module>
runner.run(smoke_tests)
File "/home/akop/py_workspace/setest/2/HTMLTestRunner.py", line 562, in run
self.generateReport(test, result)
File "/home/akop/py_workspace/setest/2/HTMLTestRunner.py", line 619, in generateReport
self.stream.write(output.encode('utf8'))
TypeError: write() argument must be str, not bytes
If I used solution of @dash0002 <https://github.com/dash0002> I got such
errors:
/usr/bin/python3.5 /home/akop/py_workspace/setest/2/smoketests_with_html_report.py
.....Traceback (most recent call last):
File "/home/akop/py_workspace/setest/2/smoketests_with_html_report.py", line 26, in <module>
runner.run(smoke_tests)
File "/home/akop/py_workspace/setest/2/HTMLTestRunner.py", line 538, in run
self.generateReport(test, result)
File "/home/akop/py_workspace/setest/2/HTMLTestRunner.py", line 586, in generateReport
report = self._generate_report(result)
File "/home/akop/py_workspace/setest/2/HTMLTestRunner.py", line 646, in _generate_report
cid = 'c%s' % (cid+1),
KeyError: 'skip'
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF0_D3J_OjgAh1BN7T6HN4ScGzRP7INjks5rnLPhgaJpZM4CWBYs>
.
|
@dash0002 yes it appears in 3.5.2. @dheerajalim unclear- please explain |
@Akopov4 I tried this and it worked. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
@Akopov4 I'd be very happy to accept a pull request for this change at https://github.com/dash0002/HTMLTestRunner (which should be 3 compatible branch). |
I've just confirmed that this package works: https://github.com/oldani/HtmlTestRunner |
This works well. |
Hello Wai Yip,
I'm using your module and it's working great!!
Recently I was trying to use an earlier version of HTMLTestRunner in Python 3.2, but it could not run. Is the new version (0.8.2) compatible for Python 3.2 ?
Thanks!
Noam.
The text was updated successfully, but these errors were encountered: