ariya / phantomjs

Scriptable Headless Browser
http://phantomjs.org
BSD 3-Clause "New" or "Revised" License
29.46k stars 5.76k forks source link

updated the run-test.py to work with python 3 #15443

Closed anilreddy closed 4 years ago

anilreddy commented 4 years ago

I have updated the run-test.py to work with python 3. Am able to run the scripts but are failing due to following error. Can any one resolve this issue.

ffFATAL: TypeError: cannot use a string pattern on a bytes-like object
## Traceback (most recent call last):
##   File "c:/Users/Anil Reddy/Downloads/phantomjs-master/test/run-tests.py", line 1057, in main    
##     sys.exit(runner.run_tests())
##   File "c:/Users/Anil Reddy/Downloads/phantomjs-master/test/run-tests.py", line 973, in run_tests
##     grp = self.run_test(test_script, tname)
##   File "c:/Users/Anil Reddy/Downloads/phantomjs-master/test/run-tests.py", line 950, in run_test 
##     grp.parse(rc, out, err)
##   File "c:/Users/Anil Reddy/Downloads/phantomjs-master/test/run-tests.py", line 643, in parse    
##     self.parse_tap(out, err)
##   File "c:/Users/Anil Reddy/Downloads/phantomjs-master/test/run-tests.py", line 655, in parse_tap
##     m = self.diag_r.match(line)
anilreddy commented 4 years ago

15414

stale[bot] commented 4 years ago

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

oddstr13 commented 2 years ago

That error is likely due to subprocess being opened in binary mode, and the output subsequently compared with a (unicode) string regex.

Fixing this could potentially be done by patting encoding="utf-8" to subprocess.Popen, but that will break backwards compatibility with python < 3.6. https://github.com/anilreddy/phantomjs/blob/318de22aa67a9eab9320da3034e6154b8e4decac/test/run-tests.py#L189-L192

An alternative way would be to loop over the stdout and stderr result lists, and decode there (if needed).

I haven't dug into whether the output is expected to be binary data or textual data.