# 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.

load("@grpc_python_dependencies//:requirements.bzl", "requirement")

package(default_testonly = 1)

py_library(
    name = "methods",
    srcs = ["methods.py"],
    imports = ["../../"],
    deps = [
        "//src/proto/grpc/testing:empty_py_pb2",
        "//src/proto/grpc/testing:py_messages_proto",
        "//src/proto/grpc/testing:py_test_proto",
        "//src/proto/grpc/testing:test_py_pb2_grpc",
        "//src/python/grpcio/grpc:grpcio",
        requirement("google-auth"),
        requirement("requests"),
        requirement("urllib3"),
        requirement("chardet"),
        requirement("certifi"),
        requirement("idna"),
    ],
)

py_test(
    name = "local_interop_test",
    size = "small",
    srcs = ["local_interop_test.py"],
    imports = ["../../"],
    python_version = "PY3",
    deps = [
        ":methods",
        "//src/python/grpcio_tests/tests/interop:resources",
        "//src/python/grpcio_tests/tests_aio/unit:_test_base",
        "//src/python/grpcio_tests/tests_aio/unit:_test_server",
    ],
)

py_binary(
    name = "server",
    srcs = ["server.py"],
    imports = ["../../"],
    python_version = "PY3",
    deps = [
        "//src/python/grpcio/grpc:grpcio",
        "//src/python/grpcio_tests/tests/interop:resources",
        "//src/python/grpcio_tests/tests/interop:server",
        "//src/python/grpcio_tests/tests_aio/unit:_test_server",
    ],
)

py_binary(
    name = "client",
    srcs = ["client.py"],
    imports = ["../../"],
    python_version = "PY3",
    deps = [
        ":methods",
        "//src/python/grpcio/grpc:grpcio",
        "//src/python/grpcio_tests/tests/interop:client_lib",
        "//src/python/grpcio_tests/tests/interop:resources",
    ],
)
