aboutsummaryrefslogtreecommitdiff
path: root/python/google/protobuf/internal/unknown_fields_test.py
diff options
context:
space:
mode:
authorTres Seaver <tseaver@palladion.com>2015-01-13 15:38:10 -0500
committerTres Seaver <tseaver@palladion.com>2015-01-13 15:38:10 -0500
commit71edc31f23918ca3c0093ce9cdb38bfa0206ed94 (patch)
treecf884942a2ecf68a1c5e82aed22c748312107957 /python/google/protobuf/internal/unknown_fields_test.py
parent47ee4d37c17db8e97fe5b15cf918ab56ff93bb18 (diff)
downloadprotobuf-71edc31f23918ca3c0093ce9cdb38bfa0206ed94.tar.gz
protobuf-71edc31f23918ca3c0093ce9cdb38bfa0206ed94.tar.bz2
protobuf-71edc31f23918ca3c0093ce9cdb38bfa0206ed94.zip
Compatibility with Python2.6 unittest.
Diffstat (limited to 'python/google/protobuf/internal/unknown_fields_test.py')
-rwxr-xr-xpython/google/protobuf/internal/unknown_fields_test.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/python/google/protobuf/internal/unknown_fields_test.py b/python/google/protobuf/internal/unknown_fields_test.py
index 0650d92b..e405f113 100755
--- a/python/google/protobuf/internal/unknown_fields_test.py
+++ b/python/google/protobuf/internal/unknown_fields_test.py
@@ -36,6 +36,17 @@
__author__ = 'bohdank@google.com (Bohdan Koval)'
import unittest
+try:
+ from unittest import skipIf
+except ImportError:
+ def skipIf(predicate, message):
+ def decorator(wrapped):
+ if predicate:
+ def _noop(*args, **kw):
+ pass
+ return _noop
+ return wrapped
+ return decorator
from google.protobuf import unittest_mset_pb2
from google.protobuf import unittest_pb2
@@ -46,7 +57,7 @@ from google.protobuf.internal import test_util
from google.protobuf.internal import type_checkers
-@unittest.skipIf(
+@skipIf(
api_implementation.Type() == 'cpp' and api_implementation.Version() == 2,
'C++ implementation does not expose unknown fields to Python')
class UnknownFieldsTest(unittest.TestCase):
@@ -180,7 +191,7 @@ class UnknownFieldsTest(unittest.TestCase):
self.assertNotEqual(self.empty_message, message)
-@unittest.skipIf(
+@skipIf(
api_implementation.Type() == 'cpp' and api_implementation.Version() == 2,
'C++ implementation does not expose unknown fields to Python')
class UnknownEnumValuesTest(unittest.TestCase):