Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

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

Closed
wants to merge 1 commit into from

Conversation

anilreddy
Copy link

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)

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.
@anilreddy
Copy link
Author

#15414

@stale stale bot added the stale label Aug 13, 2020
@stale
Copy link

stale bot commented Aug 28, 2020

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!

@stale stale bot closed this Aug 28, 2020
@oddstr13
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants