зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1147723 - Avoid non TEST_PASS/TEST_UNEXPECTED_FAIL output from test_files.py. r=gps
Instead, capture the output and check it's being printed.
This commit is contained in:
Родитель
26b3c4f285
Коммит
3b1b1b57c7
|
@ -2,10 +2,16 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
|
||||
|
||||
if len(sys.argv) != 4:
|
||||
raise Exception('Usage: minify_js_verify <exitcode> <orig> <minified>')
|
||||
|
||||
sys.exit(int(sys.argv[1]))
|
||||
retcode = int(sys.argv[1])
|
||||
|
||||
if retcode:
|
||||
print('Error message', file=sys.stderr)
|
||||
|
||||
sys.exit(retcode)
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
|
||||
from mozbuild.util import ensureParentDir
|
||||
|
||||
from mozpack.errors import ErrorMessage
|
||||
from mozpack.errors import (
|
||||
ErrorMessage,
|
||||
errors,
|
||||
)
|
||||
from mozpack.files import (
|
||||
AbsoluteSymlinkFile,
|
||||
DeflatedFile,
|
||||
|
@ -40,6 +43,7 @@ import sys
|
|||
import mozpack.path as mozpath
|
||||
from tempfile import mkdtemp
|
||||
from io import BytesIO
|
||||
from StringIO import StringIO
|
||||
from xpt import Typelib
|
||||
|
||||
|
||||
|
@ -795,10 +799,16 @@ class TestMinifiedJavaScript(TestWithTmpDir):
|
|||
|
||||
def test_minified_verify_failure(self):
|
||||
orig_f = GeneratedFile('\n'.join(self.orig_lines))
|
||||
errors.out = StringIO()
|
||||
min_f = MinifiedJavaScript(orig_f,
|
||||
verify_command=self._verify_command('1'))
|
||||
|
||||
mini_lines = min_f.open().readlines()
|
||||
output = errors.out.getvalue()
|
||||
errors.out = sys.stderr
|
||||
self.assertEqual(output,
|
||||
'Warning: JS minification verification failed for <unknown>:\n'
|
||||
'Warning: Error message\n')
|
||||
self.assertEqual(mini_lines, orig_f.open().readlines())
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче