Pull Python 3 only tests out to a separate repo

pull/21954/head
Richard Belleville 5 years ago
parent a859b9a98a
commit c01b39e55b
  1. 31
      src/python/grpcio_tests/commands.py
  2. 1
      src/python/grpcio_tests/setup.py
  3. 24
      src/python/grpcio_tests/tests/unit/BUILD.bazel
  4. 21
      src/python/grpcio_tests/tests_py3_only/__init__.py
  5. 41
      src/python/grpcio_tests/tests_py3_only/unit/BUILD.bazel
  6. 13
      src/python/grpcio_tests/tests_py3_only/unit/__init__.py
  7. 0
      src/python/grpcio_tests/tests_py3_only/unit/_simple_stubs_test.py

@ -106,6 +106,37 @@ class TestLite(setuptools.Command):
self.distribution.fetch_build_eggs(self.distribution.tests_require)
class TestPy3Only(setuptools.Command):
"""Command to run tests for Python 3+ features.
This does not include asyncio tests, which are housed in a separate
directory.
"""
description = 'run tests for py3+ features'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
self._add_eggs_to_path()
import tests
loader = tests.Loader()
loader.loadTestsFromNames(['tests_py3_only'])
runner = tests.Runner()
result = runner.run(loader.suite)
if not result.wasSuccessful():
sys.exit('Test failure')
def _add_eggs_to_path(self):
self.distribution.fetch_build_eggs(self.distribution.install_requires)
self.distribution.fetch_build_eggs(self.distribution.tests_require)
class TestAio(setuptools.Command):
"""Command to run aio tests without fetching or building anything."""

@ -59,6 +59,7 @@ COMMAND_CLASS = {
'test_lite': commands.TestLite,
'test_gevent': commands.TestGevent,
'test_aio': commands.TestAio,
'test_py3_only': commands.TestPy3Only,
}
PACKAGE_DATA = {

@ -40,10 +40,6 @@ GRPCIO_TESTS_UNIT = [
"_session_cache_test.py",
]
GRPCIO_PY3_ONLY_TESTS_UNIT = glob([
"*_py3_only_test.py",
])
py_library(
name = "_tcp_proxy",
srcs = ["_tcp_proxy.py"],
@ -114,23 +110,3 @@ py_library(
)
for test_file_name in GRPCIO_TESTS_UNIT
]
[
py_test(
name = test_file_name[:-len(".py")],
size = "small",
srcs = [test_file_name],
main = test_file_name,
python_version = "PY3",
srcs_version = "PY3",
deps = [
"resources",
"test_common",
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_tests/tests/testing",
"//src/python/grpcio_tests/tests/unit/framework/common",
"@six",
],
)
for test_file_name in GRPCIO_PY3_ONLY_TESTS_UNIT
]

@ -0,0 +1,21 @@
# Copyright 2020 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from tests import _loader
from tests import _runner
Loader = _loader.Loader
Runner = _runner.Runner

@ -0,0 +1,41 @@
# Copyright 2020 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
package(
default_testonly = True,
)
GRPCIO_PY3_ONLY_TESTS_UNIT = glob([
"*_test.py",
])
[
py_test(
name = test_file_name[:-len(".py")],
size = "small",
srcs = [test_file_name],
main = test_file_name,
python_version = "PY3",
srcs_version = "PY3",
deps = [
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_tests/tests/testing",
"//src/python/grpcio_tests/tests/unit:resources",
"//src/python/grpcio_tests/tests/unit:test_common",
"//src/python/grpcio_tests/tests/unit/framework/common",
"@six",
],
)
for test_file_name in GRPCIO_PY3_ONLY_TESTS_UNIT
]

@ -0,0 +1,13 @@
# Copyright 2019 The gRPC Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Loading…
Cancel
Save