Simply skips modules generated by protobuf
import importlib
import inspect
-import pkg_resources
import pkgutil
import unittest
@@ -19,15 +18,6 @@ def get_init_doc(klass):
return None
-def get_protobuf_version():
- ws = pkg_resources.WorkingSet()
- try:
- ws.require('protobuf<3.0.0')
- return 2
- except pkg_resources.VersionConflict:
- return 3
-
-
class TestInitDocstring(unittest.TestCase):
def check_init_docstring(self, mod, errors):
@@ -44,7 +34,6 @@ class TestInitDocstring(unittest.TestCase):
errors.append((mod, value, init_doc))
def test_init_docstring_empty(self):
- protobuf_ver = get_protobuf_version()
errors = []
root = chainer.__file__
for _, modname, _ in pkgutil.walk_packages(root):
@@ -52,11 +41,8 @@ class TestInitDocstring(unittest.TestCase):
# Skip tests
continue
- # Skip inconsistent test cases because invalid combination
- # causes segmentation fault and cannot raise an error.
- if protobuf_ver != 2 and 'protobuf2' in modname:
- continue
- if protobuf_ver != 3 and 'protobuf3' in modname:
+ # Skip modules generated by protobuf.
+ if '_pb2' in modname:
continue
try:
