From 1ff30f95502323dbe9b64747edefd6bc14f0a36a Mon Sep 17 00:00:00 2001 From: Tony Liao Date: Mon, 6 Jan 2025 15:14:49 -0800 Subject: [PATCH] Remove generator_test_wrapper for python's generator_test. The test wrappers were another way to document nonconformant behaviour between different python backends. We can achieve the same by removing the wrapper script and adding an if-condition in the test itself based on api_implementation.Type(). Since we already do that for nonconformance between pure Python vs. C++ backends, this change makes it easier to look for UPB nonconformance instead of going through another layer of indirection. Temporarily, we will need to hardcode the migrated test name in test_upb.yml because not all tests under google.protobuf.internal support UPB yet. (UPB testing for selected tests are added in https://github.com/protocolbuffers/protobuf/commit/21e9aa6cac24870edf050eb0ff9b591380340c4d). PiperOrigin-RevId: 712672890 --- .github/workflows/test_upb.yml | 2 +- python/pb_unit_tests/BUILD | 2 -- .../pb_unit_tests/generator_test_wrapper.py | 35 ------------------- 3 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 python/pb_unit_tests/generator_test_wrapper.py diff --git a/.github/workflows/test_upb.yml b/.github/workflows/test_upb.yml index cf8f238c8b355..c91d0245f4247 100644 --- a/.github/workflows/test_upb.yml +++ b/.github/workflows/test_upb.yml @@ -278,7 +278,7 @@ jobs: # We will eventually make this into a wildcard rule once all tests # have been migrated to be compatible with upb. run: | - TESTS=(message_test message_factory_test descriptor_test proto_builder_test descriptor_pool_test) + TESTS=(message_test message_factory_test descriptor_test proto_builder_test descriptor_pool_test generator_test) for test in ${TESTS[@]}; do python -m unittest -v google.protobuf.internal.${test} done diff --git a/python/pb_unit_tests/BUILD b/python/pb_unit_tests/BUILD index 8f76ba717e01c..66671a0ed473a 100644 --- a/python/pb_unit_tests/BUILD +++ b/python/pb_unit_tests/BUILD @@ -11,8 +11,6 @@ package(default_applicable_licenses = ["//:license"]) licenses(["notice"]) -pyproto_test_wrapper(name = "generator_test") - pyproto_test_wrapper(name = "reflection_test") filegroup( diff --git a/python/pb_unit_tests/generator_test_wrapper.py b/python/pb_unit_tests/generator_test_wrapper.py deleted file mode 100644 index 9ffc27f0d3c5c..0000000000000 --- a/python/pb_unit_tests/generator_test_wrapper.py +++ /dev/null @@ -1,35 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2023 Google LLC. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google LLC nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.protobuf.internal.generator_test import * -import unittest - -if __name__ == '__main__': - unittest.main(verbosity=2)