зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1473498
- [mach] Enable test_entry_points with Python 3 r=firefox-build-system-reviewers,chmanchester
Differential Revision: https://phabricator.services.mozilla.com/D36100 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3824b084b6
Коммит
975f664521
|
@ -339,14 +339,15 @@ To see more help for a specific command, run:
|
||||||
orig_env = dict(os.environ)
|
orig_env = dict(os.environ)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if stdin.encoding is None:
|
if sys.version_info < (3, 0):
|
||||||
sys.stdin = codecs.getreader('utf-8')(stdin)
|
if stdin.encoding is None:
|
||||||
|
sys.stdin = codecs.getreader('utf-8')(stdin)
|
||||||
|
|
||||||
if stdout.encoding is None:
|
if stdout.encoding is None:
|
||||||
sys.stdout = codecs.getwriter('utf-8')(stdout)
|
sys.stdout = codecs.getwriter('utf-8')(stdout)
|
||||||
|
|
||||||
if stderr.encoding is None:
|
if stderr.encoding is None:
|
||||||
sys.stderr = codecs.getwriter('utf-8')(stderr)
|
sys.stderr = codecs.getwriter('utf-8')(stderr)
|
||||||
|
|
||||||
# Allow invoked processes (which may not have a handle on the
|
# Allow invoked processes (which may not have a handle on the
|
||||||
# original stdout file descriptor) to know if the original stdout
|
# original stdout file descriptor) to know if the original stdout
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -39,8 +40,10 @@ class TestBase(unittest.TestCase):
|
||||||
|
|
||||||
stdout = StringIO()
|
stdout = StringIO()
|
||||||
stderr = StringIO()
|
stderr = StringIO()
|
||||||
stdout.encoding = 'UTF-8'
|
|
||||||
stderr.encoding = 'UTF-8'
|
if sys.version_info < (3, 0):
|
||||||
|
stdout.encoding = 'UTF-8'
|
||||||
|
stderr.encoding = 'UTF-8'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = m.run(argv, stdout=stdout, stderr=stderr)
|
result = m.run(argv, stdout=stdout, stderr=stderr)
|
||||||
|
|
|
@ -7,7 +7,6 @@ skip-if = python == 3
|
||||||
skip-if = python == 3
|
skip-if = python == 3
|
||||||
[test_dispatcher.py]
|
[test_dispatcher.py]
|
||||||
[test_entry_point.py]
|
[test_entry_point.py]
|
||||||
skip-if = python == 3
|
|
||||||
[test_error_output.py]
|
[test_error_output.py]
|
||||||
skip-if = python == 3
|
skip-if = python == 3
|
||||||
[test_logger.py]
|
[test_logger.py]
|
||||||
|
|
|
@ -39,9 +39,9 @@ class TestEntryPoints(TestBase):
|
||||||
def test_load_entry_point_from_directory(self, mock):
|
def test_load_entry_point_from_directory(self, mock):
|
||||||
# Ensure parent module is present otherwise we'll (likely) get
|
# Ensure parent module is present otherwise we'll (likely) get
|
||||||
# an error due to unknown parent.
|
# an error due to unknown parent.
|
||||||
if b'mach.commands' not in sys.modules:
|
if 'mach.commands' not in sys.modules:
|
||||||
mod = imp.new_module(b'mach.commands')
|
mod = imp.new_module('mach.commands')
|
||||||
sys.modules[b'mach.commands'] = mod
|
sys.modules['mach.commands'] = mod
|
||||||
|
|
||||||
mock.return_value = [Entry([self.provider_dir])]
|
mock.return_value = [Entry([self.provider_dir])]
|
||||||
# Mach error raised due to conditions_invalid.py
|
# Mach error raised due to conditions_invalid.py
|
||||||
|
|
Загрузка…
Ссылка в новой задаче