Files
WeHub Mirror 16d3f15320
ARM CI / build (3.10) (push) Has been cancelled
cffconvert / validate (push) Has been cancelled
Creates a GitHub Issue when a PR Rolled back via Commit to Master / create-issue-on-pr-rollback (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
WeHub snapshot of ee606724a5c2f63bf60704cb3e1b169618993fd9
2026-08-07 16:11:07 +08:00

177 lines
4.8 KiB
Python

# Copyright 2026 The TensorFlow Authors. All Rights Reserved.
#
# 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.
# ==============================================================================
# Tests of tf.io.*proto.
load("@rules_python//python:proto.bzl", "py_proto_library")
load("@xla//third_party/rules_python/python:py_library.bzl", "py_library")
load("//tensorflow:tensorflow.bzl", "if_oss", "tf_cc_shared_object")
load("//tensorflow:tensorflow.default.bzl", "stripped_cc_info", "tf_py_strict_test")
load("//tensorflow/core/platform:build_config.bzl", "tf_additional_all_protos", "tf_proto_library")
load("//tensorflow/core/platform:build_config_root.bzl", "if_pywrap")
package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
default_visibility = ["//visibility:public"],
licenses = ["notice"],
)
exports_files([
"test_example.proto",
])
tf_py_strict_test(
name = "decode_proto_op_test",
size = "small",
srcs = ["decode_proto_op_test.py"],
data = if_oss([":libtestexample.so"]),
tags = [
"no_pip", # TODO(b/78026780)
"no_windows", # TODO(b/78028010)
],
deps = [
":decode_proto_op_test_base",
":py_test_deps",
"//tensorflow/python/ops:proto_ops",
"//tensorflow/python/platform:client_testlib",
],
)
tf_py_strict_test(
name = "encode_proto_op_test",
size = "small",
srcs = ["encode_proto_op_test.py"],
data = if_oss([":libtestexample.so"]),
tags = [
"no_pip", # TODO(b/78026780)
"no_windows", # TODO(b/78028010)
],
deps = [
":encode_proto_op_test_base",
":py_test_deps",
"//tensorflow/python/ops:proto_ops",
"//tensorflow/python/platform:client_testlib",
],
)
py_library(
name = "proto_op_test_base",
testonly = 1,
srcs = ["proto_op_test_base.py"],
strict_deps = True,
deps = [
":test_example_proto_py",
"//tensorflow/core:protos_all_py",
"//tensorflow/python/platform:client_testlib",
],
)
py_library(
name = "decode_proto_op_test_base",
testonly = 1,
srcs = ["decode_proto_op_test_base.py"],
strict_deps = True,
deps = [
":proto_op_test_base",
":test_example_proto_py",
"//tensorflow/python/framework:dtypes",
"//tensorflow/python/framework:errors",
"//third_party/py/numpy",
"@absl_py//absl/testing:parameterized",
],
)
py_library(
name = "encode_proto_op_test_base",
testonly = 1,
srcs = ["encode_proto_op_test_base.py"],
strict_deps = True,
deps = [
":proto_op_test_base",
":test_example_proto_py",
"//tensorflow/python/eager:context",
"//tensorflow/python/framework:dtypes",
"//tensorflow/python/framework:errors",
"//tensorflow/python/ops:array_ops",
"//third_party/py/numpy",
"@absl_py//absl/testing:parameterized",
],
)
py_library(
name = "py_test_deps",
strict_deps = True,
)
tf_proto_library(
name = "test_example_proto",
srcs = ["test_example.proto"],
protodeps = tf_additional_all_protos(),
)
tf_cc_shared_object(
name = "libtestexample.so",
linkstatic = 1,
deps = if_pywrap(
if_false = [
":test_example_proto_cc",
],
if_true = [
"//tensorflow/python:tensorflow_common_framework",
":test_example_proto_cc_stripped",
],
),
)
stripped_cc_info(
name = "test_example_proto_cc_stripped",
deps = [":test_example_proto_cc"],
)
py_library(
name = "descriptor_source_test_base",
testonly = 1,
srcs = ["descriptor_source_test_base.py"],
strict_deps = True,
deps = [
":proto_op_test_base",
"//tensorflow/python/framework:dtypes",
"//tensorflow/python/platform:client_testlib",
"//third_party/py/numpy",
"@com_google_protobuf//:protobuf_python",
],
)
tf_py_strict_test(
name = "descriptor_source_test",
size = "small",
srcs = ["descriptor_source_test.py"],
tags = [
"no_pip",
],
deps = [
":descriptor_source_test_base",
"//tensorflow/python/ops:proto_ops",
"//tensorflow/python/platform:client_testlib",
],
)
# copybara:uncomment_begin(google-only)
# py_proto_library(
# name = "test_example_proto_py",
# deps = [":test_example_proto"],
# )
# copybara:uncomment_end