mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 1640703 - Fix Python 2/3 incompatibility when running mach jstests
r=jgraham
Bug 1632916 regressed `mach jstests`, which still run under Python 2 (unlike the in-build `jstests`, which use Python 3). Here we call into different logic for Python 2 and 3 to make sure there aren't type mismatches down the line. Differential Revision: https://phabricator.services.mozilla.com/D76922
This commit is contained in:
parent
af94e32736
commit
c364c46587
@ -8,6 +8,7 @@ import io
|
||||
import os
|
||||
import posixpath
|
||||
import re
|
||||
import six
|
||||
import sys
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
@ -379,7 +380,10 @@ def _parse_test_header(fullpath, testcase, xul_tester):
|
||||
This looks a bit weird. The reason is that it needs to be efficient, since
|
||||
it has to be done on every test
|
||||
"""
|
||||
fp = io.open(fullpath, 'r', encoding='utf-8')
|
||||
if six.PY3:
|
||||
fp = open(fullpath, encoding='utf-8')
|
||||
else:
|
||||
fp = open(fullpath)
|
||||
try:
|
||||
buf = fp.read(512)
|
||||
finally:
|
||||
|
Loading…
Reference in New Issue
Block a user