Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
833c046f
Commit
833c046f
authored
Aug 13, 2015
by
Dan O'Reilly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing some tests
Signed-off-by:
Dan O'Reilly
<
oreilldf@gmail.com
>
parent
e47cdd5a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
42 deletions
+30
-42
_parameterized.py
python/google/protobuf/internal/_parameterized.py
+6
-4
python_message.py
python/google/protobuf/internal/python_message.py
+1
-2
reflection_test.py
python/google/protobuf/internal/reflection_test.py
+1
-1
setup.py
python/setup.py
+22
-35
No files found.
python/google/protobuf/internal/_parameterized.py
View file @
833c046f
...
...
@@ -152,6 +152,8 @@ import types
import
unittest
import
uuid
import
six
ADDR_RE
=
re
.
compile
(
r'\<([a-zA-Z0-9_\-\.]+) object at 0x[a-fA-F0-9]+\>'
)
_SEPARATOR
=
uuid
.
uuid1
()
.
hex
_FIRST_ARG
=
object
()
...
...
@@ -170,13 +172,13 @@ def _StrClass(cls):
def
_NonStringIterable
(
obj
):
return
(
isinstance
(
obj
,
collections
.
Iterable
)
and
not
isinstance
(
obj
,
basestring
))
isinstance
(
obj
,
six
.
string_types
))
def
_FormatParameterList
(
testcase_params
):
if
isinstance
(
testcase_params
,
collections
.
Mapping
):
return
', '
.
join
(
'
%
s=
%
s'
%
(
argname
,
_CleanRepr
(
value
))
for
argname
,
value
in
testcase_params
.
ite
rite
ms
())
for
argname
,
value
in
testcase_params
.
items
())
elif
_NonStringIterable
(
testcase_params
):
return
', '
.
join
(
map
(
_CleanRepr
,
testcase_params
))
else
:
...
...
@@ -258,7 +260,7 @@ def _ModifyClass(class_object, testcases, naming_type):
'Cannot add parameters to
%
s,'
' which already has parameterized methods.'
%
(
class_object
,))
class_object
.
_id_suffix
=
id_suffix
=
{}
for
name
,
obj
in
class_object
.
__dict__
.
items
():
for
name
,
obj
in
class_object
.
__dict__
.
copy
()
.
items
():
if
(
name
.
startswith
(
unittest
.
TestLoader
.
testMethodPrefix
)
and
isinstance
(
obj
,
types
.
FunctionType
)):
delattr
(
class_object
,
name
)
...
...
@@ -266,7 +268,7 @@ def _ModifyClass(class_object, testcases, naming_type):
_UpdateClassDictForParamTestCase
(
methods
,
id_suffix
,
name
,
_ParameterizedTestIter
(
obj
,
testcases
,
naming_type
))
for
name
,
meth
in
methods
.
ite
rite
ms
():
for
name
,
meth
in
methods
.
items
():
setattr
(
class_object
,
name
,
meth
)
...
...
python/google/protobuf/internal/python_message.py
View file @
833c046f
...
...
@@ -59,7 +59,6 @@ import weakref
import
six
import
six.moves.copyreg
as
copyreg
import
six.string_types
# We use "as" to avoid name collisions with variables.
from
google.protobuf.internal
import
containers
...
...
@@ -1120,7 +1119,7 @@ def _AddIsInitializedMethod(message_descriptor, cls):
# ScalarMaps can't have any initialization errors.
pass
elif
field
.
label
==
_FieldDescriptor
.
LABEL_REPEATED
:
for
i
in
x
range
(
len
(
value
)):
for
i
in
range
(
len
(
value
)):
element
=
value
[
i
]
prefix
=
"
%
s[
%
d]."
%
(
name
,
i
)
sub_errors
=
element
.
FindInitializationErrors
()
...
...
python/google/protobuf/internal/reflection_test.py
View file @
833c046f
...
...
@@ -1634,7 +1634,7 @@ class ReflectionTest(unittest.TestCase):
self
.
assertFalse
(
proto
.
IsInitialized
(
errors
))
self
.
assertEqual
(
errors
,
[
'a'
,
'b'
,
'c'
])
@
basetest.unittest.
skipIf
(
@skipIf
(
api_implementation
.
Type
()
!=
'cpp'
or
api_implementation
.
Version
()
!=
2
,
'Errors are only available from the most recent C++ implementation.'
)
def
testFileDescriptorErrors
(
self
):
...
...
python/setup.py
View file @
833c046f
...
...
@@ -88,41 +88,27 @@ def generate_proto(source, require = True):
sys
.
exit
(
-
1
)
def
GenerateUnittestProtos
():
generate_proto
(
"../src/google/protobuf/unittest.proto"
)
generate_proto
(
"../src/google/protobuf/unittest_custom_options.proto"
)
generate_proto
(
"../src/google/protobuf/unittest_import.proto"
)
generate_proto
(
"../src/google/protobuf/unittest_import_public.proto"
)
generate_proto
(
"../src/google/protobuf/unittest_mset.proto"
)
generate_proto
(
"../src/google/protobuf/unittest_no_generic_services.proto"
)
generate_proto
(
"google/protobuf/internal/descriptor_pool_test1.proto"
)
generate_proto
(
"google/protobuf/internal/descriptor_pool_test2.proto"
)
generate_proto
(
"google/protobuf/internal/test_bad_identifiers.proto"
)
generate_proto
(
"google/protobuf/internal/missing_enum_values.proto"
)
generate_proto
(
"google/protobuf/internal/more_extensions.proto"
)
generate_proto
(
"google/protobuf/internal/more_extensions_dynamic.proto"
)
generate_proto
(
"google/protobuf/internal/more_messages.proto"
)
generate_proto
(
"google/protobuf/internal/factory_test1.proto"
)
generate_proto
(
"google/protobuf/internal/factory_test2.proto"
)
generate_proto
(
"google/protobuf/internal/import_test_package/inner.proto"
)
generate_proto
(
"google/protobuf/internal/import_test_package/outer.proto"
)
generate_proto
(
"google/protobuf/pyext/python.proto"
)
def
MakeTestSuite
():
# Test C++ implementation
import
unittest
import
google.protobuf.pyext.descriptor_cpp2_test
as
descriptor_cpp2_test
import
google.protobuf.pyext.message_factory_cpp2_test
\
as
message_factory_cpp2_test
import
google.protobuf.pyext.reflection_cpp2_generated_test
\
as
reflection_cpp2_generated_test
loader
=
unittest
.
defaultTestLoader
suite
=
unittest
.
TestSuite
()
for
test
in
[
descriptor_cpp2_test
,
message_factory_cpp2_test
,
reflection_cpp2_generated_test
]:
suite
.
addTest
(
loader
.
loadTestsFromModule
(
test
))
return
suite
generate_proto
(
"../src/google/protobuf/map_unittest.proto"
,
False
)
generate_proto
(
"../src/google/protobuf/unittest.proto"
,
False
)
generate_proto
(
"../src/google/protobuf/unittest_custom_options.proto"
,
False
)
generate_proto
(
"../src/google/protobuf/unittest_import.proto"
,
False
)
generate_proto
(
"../src/google/protobuf/unittest_import_public.proto"
,
False
)
generate_proto
(
"../src/google/protobuf/unittest_mset.proto"
,
False
)
generate_proto
(
"../src/google/protobuf/unittest_no_generic_services.proto"
,
False
)
generate_proto
(
"../src/google/protobuf/unittest_proto3_arena.proto"
,
False
)
generate_proto
(
"google/protobuf/internal/descriptor_pool_test1.proto"
,
False
)
generate_proto
(
"google/protobuf/internal/descriptor_pool_test2.proto"
,
False
)
generate_proto
(
"google/protobuf/internal/factory_test1.proto"
,
False
)
generate_proto
(
"google/protobuf/internal/factory_test2.proto"
,
False
)
generate_proto
(
"google/protobuf/internal/import_test_package/inner.proto"
,
False
)
generate_proto
(
"google/protobuf/internal/import_test_package/outer.proto"
,
False
)
generate_proto
(
"google/protobuf/internal/missing_enum_values.proto"
,
False
)
generate_proto
(
"google/protobuf/internal/more_extensions.proto"
,
False
)
generate_proto
(
"google/protobuf/internal/more_extensions_dynamic.proto"
,
False
)
generate_proto
(
"google/protobuf/internal/more_messages.proto"
,
False
)
generate_proto
(
"google/protobuf/internal/test_bad_identifiers.proto"
,
False
)
generate_proto
(
"google/protobuf/pyext/python.proto"
,
False
)
class
clean
(
_clean
):
def
run
(
self
):
...
...
@@ -153,6 +139,7 @@ class build_py(_build_py):
# _build_py is an old-style class, so super() doesn't work.
_build_py
.
run
(
self
)
if
__name__
==
'__main__'
:
ext_module_list
=
[]
cpp_impl
=
'--cpp_implementation'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment