Backed out changeset aaabe6d53de2 (bug 1428713) for causing Bug 1483850 a=backout

This commit is contained in:
Tiberius Oros 2018-08-17 00:17:04 +03:00
parent 1fc4333268
commit fffda63981
8 changed files with 27 additions and 31 deletions

View File

@ -13,10 +13,7 @@ import threading
import time
import traceback
try:
from queue import Queue, Empty
except ImportError:
from Queue import Queue, Empty
from Queue import Queue, Empty
from datetime import datetime
@ -127,14 +124,14 @@ class ProcessHandlerMixin(object):
thread = threading.current_thread().name
print("DBG::MOZPROC PID:{} ({}) | {}".format(self.pid, thread, msg))
def __del__(self, _maxint=sys.maxsize):
def __del__(self, _maxint=sys.maxint):
if isWin:
handle = getattr(self, '_handle', None)
if handle:
if hasattr(self, '_internal_poll'):
self._internal_poll(_deadstate=_maxint)
else:
self.poll(_deadstate=sys.maxsize)
self.poll(_deadstate=sys.maxint)
if handle or self._job or self._io_port:
self._cleanup()
else:
@ -1072,7 +1069,7 @@ class StreamOutput(object):
def __call__(self, line):
try:
self.stream.write(line.decode() + '\n')
self.stream.write(line + '\n')
except UnicodeDecodeError:
# TODO: Workaround for bug #991866 to make sure we can display when
# when normal UTF-8 display is failing

View File

@ -6,7 +6,7 @@ from __future__ import absolute_import
from setuptools import setup
PACKAGE_VERSION = '1.0.0'
PACKAGE_VERSION = '0.26'
setup(name='mozprocess',
version=PACKAGE_VERSION,
@ -17,8 +17,7 @@ setup(name='mozprocess',
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5'
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
],
keywords='mozilla',

View File

@ -1,5 +1,6 @@
[DEFAULT]
subsuite = mozbase, os == "linux"
skip-if = python == 3
[test_kill.py]
[test_misc.py]
[test_poll.py]

View File

@ -4,10 +4,7 @@ from __future__ import absolute_import, print_function
import argparse
import collections
try:
import configparser as ConfigParser
except ImportError:
import ConfigParser
import ConfigParser
import multiprocessing
import time

View File

@ -2,13 +2,13 @@
from __future__ import absolute_import
import io
import os
import mozunit
import proctest
from mozprocess import processhandler
import six
here = os.path.dirname(os.path.abspath(__file__))
@ -49,24 +49,26 @@ class ProcTestOutput(proctest.ProcTest):
"""
expected = '\n'.join([str(n) for n in range(0, 10)])
stream = six.StringIO()
stream = io.BytesIO()
buf = io.BufferedRandom(stream)
p = processhandler.ProcessHandler([self.python,
os.path.join("scripts", "proccountfive.py")],
cwd=here,
stream=stream)
stream=buf)
p.run()
p.wait()
for i in range(5, 10):
stream.write(str(i) + '\n')
buf.flush()
self.assertEquals(stream.getvalue().strip(), expected)
# make sure mozprocess doesn't close the stream
# since mozprocess didn't create it
self.assertFalse(stream.closed)
stream.close()
self.assertFalse(buf.closed)
buf.close()
self.determine_status(p, False, ())

View File

@ -33,11 +33,11 @@ class TestProcessReader(unittest.TestCase):
timeout_callback=on_timeout)
def test_stdout_callback(self):
proc = run_python('print(1); print(2)')
proc = run_python('print 1; print 2')
self.reader.start(proc)
self.reader.thread.join()
self.assertEqual(self.out.output, [b'1', b'2'])
self.assertEqual(self.out.output, ['1', '2'])
self.assertEqual(self.err.output, [])
def test_stderr_callback(self):
@ -46,15 +46,15 @@ class TestProcessReader(unittest.TestCase):
self.reader.thread.join()
self.assertEqual(self.out.output, [])
self.assertEqual(self.err.output, [b'hello world'])
self.assertEqual(self.err.output, ['hello world'])
def test_stdout_and_stderr_callbacks(self):
proc = run_python('import sys; sys.stderr.write("hello world\\n"); print(1); print(2)')
proc = run_python('import sys; sys.stderr.write("hello world\\n"); print 1; print 2')
self.reader.start(proc)
self.reader.thread.join()
self.assertEqual(self.out.output, [b'1', b'2'])
self.assertEqual(self.err.output, [b'hello world'])
self.assertEqual(self.out.output, ['1', '2'])
self.assertEqual(self.err.output, ['hello world'])
def test_finished_callback(self):
self.assertFalse(self.finished)
@ -85,21 +85,21 @@ class TestProcessReader(unittest.TestCase):
proc = run_python('import sys; sys.stdout.write("1")')
self.reader.start(proc)
self.reader.thread.join()
self.assertEqual(self.out.output, [b'1'])
self.assertEqual(self.out.output, ['1'])
def test_read_with_strange_eol(self):
proc = run_python('import sys; sys.stdout.write("1\\r\\r\\r\\n")')
self.reader.start(proc)
self.reader.thread.join()
self.assertEqual(self.out.output, [b'1'])
self.assertEqual(self.out.output, ['1'])
def test_mixed_stdout_stderr(self):
proc = run_python('import sys; sys.stderr.write("hello world\\n"); print(1); print(2)',
proc = run_python('import sys; sys.stderr.write("hello world\\n"); print 1; print 2',
stderr=subprocess.STDOUT)
self.reader.start(proc)
self.reader.thread.join()
self.assertEqual(sorted(self.out.output), sorted([b'1', b'2', b'hello world']))
self.assertEqual(sorted(self.out.output), sorted(['1', '2', 'hello world']))
self.assertEqual(self.err.output, [])

View File

@ -16,7 +16,7 @@ deps = [
'mozfile==1.*',
'mozinfo>=0.7,<2',
'mozlog==3.*',
'mozprocess>=0.23,<2',
'mozprocess>=0.23,<1',
'mozprofile>=1.1.0,<2',
'six>=1.10.0,<2',
]

View File

@ -13,7 +13,7 @@ deps = ['httplib2 == 0.9.2',
'mozhttpd == 0.7',
'mozinfo >= 0.10',
'mozinstall == 1.16',
'mozprocess == 1.0.0',
'mozprocess == 0.26',
'mozprofile == 1.1.0',
'mozrunner == 7.0.1',
'mozversion == 1.5',