Fix for internal running of tests.

PiperOrigin-RevId: 444297087
pull/13171/head
Joshua Haberman 3 years ago committed by Copybara-Service
parent 7f9135b766
commit 92e06d027c
  1. 9
      python/descriptor_pool.c
  2. 11
      python/pb_unit_tests/descriptor_pool_test_wrapper.py

@ -572,11 +572,18 @@ static PyObject* PyUpb_DescriptorPool_FindAllExtensions(PyObject* _self,
size_t n;
const upb_FieldDef** ext = upb_DefPool_GetAllExtensions(self->symtab, m, &n);
PyObject* ret = PyList_New(n);
if (!ret) goto done;
for (size_t i = 0; i < n; i++) {
PyObject* field = PyUpb_FieldDescriptor_Get(ext[i]);
if (!field) return NULL;
if (!field) {
Py_DECREF(ret);
ret = NULL;
goto done;
}
PyList_SetItem(ret, i, field);
}
done:
free(ext);
return ret;
}

@ -23,13 +23,8 @@
# (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 import descriptor_pool_test
import unittest
import copy
# begin:google_only
# from google3.testing.pybase import googletest
# end:google_only
from google.protobuf.internal import descriptor_pool_test
# This is testing that certain methods unconditionally throw TypeError.
# In the new extension we simply don't define them at all.
@ -43,6 +38,8 @@ if __name__ == '__main__':
# end:github_only
# begin:google_only
# descriptor_pool_test.CreateDescriptorPoolTest.testComplexNestingWithProtoFileParser.__unittest_expecting_failure__ = True
# from absl import app
# if __name__ == '__main__':
# googletest.main()
# app.run(lambda argv: unittest.main(module=descriptor_pool_test, verbosity=2))
# end:google_only

Loading…
Cancel
Save