aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-06-11 09:56:50 -0700
committerGravatar GitHub <noreply@github.com>2016-06-11 09:56:50 -0700
commit68e5ecbee4882a74b16a6e22d935d68798016804 (patch)
tree7907fd4b2ef3d99decb82f9d2d435b0c53436e41 /tools/run_tests
parentead54999ac13216dac7a92204d8444479012eaf7 (diff)
parent1efb6017ec1edb26706895dfe71f4d72ea387cf4 (diff)
Merge pull request #6503 from kpayson64/python_3_support
Initial Python3 support
Diffstat (limited to 'tools/run_tests')
-rwxr-xr-xtools/run_tests/build_python.sh15
-rwxr-xr-xtools/run_tests/run_python.sh1
-rwxr-xr-xtools/run_tests/run_tests.py29
3 files changed, 33 insertions, 12 deletions
diff --git a/tools/run_tests/build_python.sh b/tools/run_tests/build_python.sh
index 4cc6881ef5..b1c90df824 100755
--- a/tools/run_tests/build_python.sh
+++ b/tools/run_tests/build_python.sh
@@ -34,6 +34,7 @@ set -ex
cd $(dirname $0)/../..
TOX_PYTHON_ENV="$1"
+PY_VERSION="${TOX_PYTHON_ENV: -2}"
ROOT=`pwd`
export LD_LIBRARY_PATH=$ROOT/libs/$CONFIG
@@ -51,11 +52,25 @@ fi
tox -e ${TOX_PYTHON_ENV} --notest
+# We force the .so naming convention in PEP 3149 for side by side installation support
+# Note this is the default in Python3, but explicitly disabled for Darwin, so we only
+# use this hack for our testing environment.
+if [ "$PY_VERSION" -gt "27" ]
+then
+ mv $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so.backup || true
+fi
+
$ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py build
$ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py build_py
$ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py build_ext --inplace
$ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py gather --test
+if [ "$PY_VERSION" -gt "27" ]
+then
+ mv $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so $ROOT/src/python/grpcio/grpc/_cython/cygrpc.cpython-${PY_VERSION}m.so || true
+ mv $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so.backup $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so || true
+fi
+
# Build the health checker
$ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/src/python/grpcio_health_checking/setup.py build
$ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/src/python/grpcio_health_checking/setup.py build_py
diff --git a/tools/run_tests/run_python.sh b/tools/run_tests/run_python.sh
index 7a3ce6b821..8059059d41 100755
--- a/tools/run_tests/run_python.sh
+++ b/tools/run_tests/run_python.sh
@@ -55,3 +55,4 @@ fi
mkdir -p $ROOT/reports
rm -rf $ROOT/reports/python-coverage
(mv -T $ROOT/htmlcov $ROOT/reports/python-coverage) || true
+
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 4490bac898..3080d19c8d 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -387,7 +387,7 @@ class PythonLanguage(object):
def configure(self, config, args):
self.config = config
self.args = args
- self._tox_env = self._get_tox_env(self.args.compiler)
+ self._tox_envs = self._get_tox_envs(self.args.compiler)
def test_specs(self):
# load list of known test suites
@@ -399,19 +399,21 @@ class PythonLanguage(object):
os.path.abspath('src/python/grpcio_health_checking'))
if self.config.build_config != 'gcov':
return [self.config.job_spec(
- ['tools/run_tests/run_python.sh', self._tox_env],
+ ['tools/run_tests/run_python.sh', tox_env],
None,
environ=dict(environment.items() +
[('GRPC_PYTHON_TESTRUNNER_FILTER', suite_name)]),
- shortname='py.test.%s' % suite_name,
+ shortname='%s.test.%s' % (tox_env, suite_name),
timeout_seconds=5*60)
- for suite_name in tests_json]
+ for suite_name in tests_json
+ for tox_env in self._tox_envs]
else:
- return [self.config.job_spec(['tools/run_tests/run_python.sh'],
+ return [self.config.job_spec(['tools/run_tests/run_python.sh', tox_env],
None,
environ=environment,
- shortname='py.test.coverage',
- timeout_seconds=15*60)]
+ shortname='%s.test.coverage' % tox_env,
+ timeout_seconds=15*60)
+ for tox_env in self._tox_envs]
def pre_build_steps(self):
@@ -424,7 +426,8 @@ class PythonLanguage(object):
return []
def build_steps(self):
- return [['tools/run_tests/build_python.sh', self._tox_env]]
+ return [['tools/run_tests/build_python.sh', tox_env]
+ for tox_env in self._tox_envs]
def post_tests_steps(self):
return []
@@ -435,12 +438,14 @@ class PythonLanguage(object):
def dockerfile_dir(self):
return 'tools/dockerfile/test/python_jessie_%s' % _docker_arch_suffix(self.args.arch)
- def _get_tox_env(self, compiler):
+ def _get_tox_envs(self, compiler):
"""Returns name of tox environment based on selected compiler."""
- if compiler == 'python2.7' or compiler == 'default':
- return 'py27'
+ if compiler == 'default':
+ return ('py27', 'py34')
+ elif compiler == 'python2.7':
+ return ('py27',)
elif compiler == 'python3.4':
- return 'py34'
+ return ('py34',)
else:
raise Exception('Compiler %s not supported.' % compiler)