Backed out changeset 19269e470c71 (bug 1594914) for causing bustages.

CLOSED TREE
This commit is contained in:
Mihai Alexandru Michis
2020-07-09 01:36:29 +03:00
parent 17544bfe34
commit 222d4971d6
7 changed files with 19 additions and 60 deletions

View File

@@ -11,8 +11,6 @@ import sys
import tempfile
from multiprocessing import cpu_count
import six
from concurrent.futures import (
ThreadPoolExecutor,
as_completed,
@@ -99,7 +97,7 @@ class MachCommands(MachCommandBase):
action='store_true',
help='Verbose output.')
@CommandArgument('--python',
default='3',
default='2.7',
help='Version of Python for Pipenv to use. When given a '
'Python version, Pipenv will automatically scan your '
'system for a Python that matches that given version.')
@@ -126,11 +124,7 @@ class MachCommands(MachCommandBase):
'passed as it is to pytest'))
def python_test(self, *args, **kwargs):
try:
tempdir = str(tempfile.mkdtemp(suffix='-python-test'))
if six.PY2:
os.environ[b'PYTHON_TEST_TMP'] = tempdir
else:
os.environ['PYTHON_TEST_TMP'] = tempdir
tempdir = os.environ[b'PYTHON_TEST_TMP'] = str(tempfile.mkdtemp(suffix='-python-test'))
return self.run_python_tests(*args, **kwargs)
finally:
import mozfile
@@ -288,7 +282,6 @@ class MachCommands(MachCommandBase):
file_displayed_test = [] # used as boolean
def _line_handler(line):
line = six.ensure_str(line)
if not file_displayed_test:
output = ('Ran' in line or 'collected' in line or
line.startswith('TEST-'))
@@ -296,8 +289,8 @@ class MachCommands(MachCommandBase):
file_displayed_test.append(True)
# Hack to make sure treeherder highlights pytest failures
if 'FAILED' in line.rsplit(' ', 1)[-1]:
line = line.replace('FAILED', 'TEST-UNEXPECTED-FAIL')
if b'FAILED' in line.rsplit(b' ', 1)[-1]:
line = line.replace(b'FAILED', b'TEST-UNEXPECTED-FAIL')
_log(line)
@@ -305,18 +298,12 @@ class MachCommands(MachCommandBase):
python = self.virtualenv_manager.python_path
cmd = [python, test['path']]
env = os.environ.copy()
if six.PY2:
env[b'PYTHONDONTWRITEBYTECODE'] = b'1'
else:
env['PYTHONDONTWRITEBYTECODE'] = '1'
env[b'PYTHONDONTWRITEBYTECODE'] = b'1'
# Homebrew on OS X will change Python's sys.executable to a custom value
# which messes with mach's virtualenv handling code. Override Homebrew's
# changes with the correct sys.executable value.
if six.PY2:
env[b'PYTHONEXECUTABLE'] = python.encode('utf-8')
else:
env['PYTHONEXECUTABLE'] = python
env[b'PYTHONEXECUTABLE'] = python.encode('utf-8')
proc = ProcessHandler(cmd, env=env, processOutputLine=_line_handler, storeOutput=False)
proc.run()