зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1472177 - Run mozversioncontrol tests under python 3 r=gps
This also enables the py2 linter which will help maintain compatibility with both 2 and 3. Differential Revision: https://phabricator.services.mozilla.com/D1884 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
5574f1d788
Коммит
21dc8454f4
|
@ -9,8 +9,8 @@ import errno
|
|||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import which
|
||||
|
||||
from distutils.spawn import find_executable
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
|
||||
|
@ -48,22 +48,12 @@ def get_tool_path(tool):
|
|||
if os.path.isabs(tool) and os.path.exists(tool):
|
||||
return tool
|
||||
|
||||
# We use subprocess in places, which expects a Win32 executable or
|
||||
# batch script. On some versions of MozillaBuild, we have "hg.exe",
|
||||
# "hg.bat," and "hg" (a Python script). "which" will happily return the
|
||||
# Python script, which will cause subprocess to choke. Explicitly favor
|
||||
# the Windows version over the plain script.
|
||||
try:
|
||||
return which.which(tool + '.exe')
|
||||
except which.WhichError:
|
||||
try:
|
||||
return which.which(tool)
|
||||
except which.WhichError:
|
||||
pass
|
||||
|
||||
raise MissingVCSTool('Unable to obtain %s path. Try running '
|
||||
'|mach bootstrap| to ensure your environment is up to '
|
||||
'date.' % tool)
|
||||
path = find_executable(tool)
|
||||
if not path:
|
||||
raise MissingVCSTool('Unable to obtain %s path. Try running '
|
||||
'|mach bootstrap| to ensure your environment is up to '
|
||||
'date.' % tool)
|
||||
return path
|
||||
|
||||
|
||||
class Repository(object):
|
||||
|
@ -98,7 +88,8 @@ class Repository(object):
|
|||
try:
|
||||
return subprocess.check_output(cmd,
|
||||
cwd=self.path,
|
||||
env=self._env)
|
||||
env=self._env,
|
||||
universal_newlines=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
if e.returncode in return_codes:
|
||||
return ''
|
||||
|
@ -263,7 +254,10 @@ class HgRepository(Repository):
|
|||
def _run(self, *args, **runargs):
|
||||
if not self._client.server:
|
||||
return super(HgRepository, self)._run(*args, **runargs)
|
||||
return self._client.rawcommand(args)
|
||||
|
||||
# hglib requires bytes on python 3
|
||||
args = [a.encode('utf-8') if not isinstance(a, bytes) else a for a in args]
|
||||
return self._client.rawcommand(args).decode('utf-8')
|
||||
|
||||
def sparse_checkout_present(self):
|
||||
# We assume a sparse checkout is enabled if the .hg/sparse file
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# 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 unicode_literals
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
|
|
@ -20,7 +20,10 @@ setup(
|
|||
'Development Status :: 3 - Alpha',
|
||||
'Topic :: Software Development :: Build Tools',
|
||||
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
|
||||
'Programming Language :: Python :: 2',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: Implementation :: CPython',
|
||||
],
|
||||
keywords='mozilla',
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
[DEFAULT]
|
||||
subsuite=mozversioncontrol
|
||||
skip-if = python == 3
|
||||
|
||||
[test_context_manager.py]
|
||||
[test_push_to_try.py]
|
||||
|
|
|
@ -138,7 +138,7 @@ mozterm:
|
|||
|
||||
mozversioncontrol:
|
||||
description: python/mozversioncontrol unit tests
|
||||
python-version: [2]
|
||||
python-version: [2, 3]
|
||||
treeherder:
|
||||
symbol: vcs
|
||||
run:
|
||||
|
|
|
@ -29,7 +29,6 @@ py2:
|
|||
- python/devtools
|
||||
- python/mach
|
||||
- python/mozbuild
|
||||
- python/mozversioncontrol
|
||||
- security
|
||||
- servo
|
||||
- taskcluster/docker/funsize-update-generator
|
||||
|
|
Загрузка…
Ссылка в новой задаче