aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2015-10-05 16:08:22 -0700
committerGravatar Jisi Liu <jisi.liu@gmail.com>2015-10-05 16:08:22 -0700
commitdbea00ae882b0a1df1f76cb5b23657234bf073c4 (patch)
tree75a2effc7e836c4e65896bdf2e0942a0dbe25b91
parenta783eaf37f42702a0752698926f24edea8612922 (diff)
Revert back changes to import unittest2 for py26
-rw-r--r--python/google/protobuf/internal/descriptor_database_test.py5
-rw-r--r--python/google/protobuf/internal/descriptor_pool_test.py5
-rwxr-xr-xpython/google/protobuf/internal/descriptor_test.py7
-rwxr-xr-xpython/google/protobuf/internal/generator_test.py5
-rw-r--r--python/google/protobuf/internal/json_format_test.py5
-rw-r--r--python/google/protobuf/internal/message_factory_test.py5
-rwxr-xr-xpython/google/protobuf/internal/message_test.py5
-rw-r--r--python/google/protobuf/internal/proto_builder_test.py5
-rwxr-xr-xpython/google/protobuf/internal/reflection_test.py9
-rwxr-xr-xpython/google/protobuf/internal/service_reflection_test.py5
-rw-r--r--python/google/protobuf/internal/symbol_database_test.py5
-rwxr-xr-xpython/google/protobuf/internal/test_util.py7
-rwxr-xr-xpython/google/protobuf/internal/text_encoding_test.py5
-rwxr-xr-xpython/google/protobuf/internal/text_format_test.py5
-rwxr-xr-xpython/google/protobuf/internal/unknown_fields_test.py7
-rwxr-xr-xpython/google/protobuf/internal/wire_format_test.py5
16 files changed, 64 insertions, 26 deletions
diff --git a/python/google/protobuf/internal/descriptor_database_test.py b/python/google/protobuf/internal/descriptor_database_test.py
index 3241cb72..1baff7d1 100644
--- a/python/google/protobuf/internal/descriptor_database_test.py
+++ b/python/google/protobuf/internal/descriptor_database_test.py
@@ -34,7 +34,10 @@
__author__ = 'matthewtoia@google.com (Matt Toia)'
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import descriptor_pb2
from google.protobuf.internal import factory_test2_pb2
from google.protobuf import descriptor_database
diff --git a/python/google/protobuf/internal/descriptor_pool_test.py b/python/google/protobuf/internal/descriptor_pool_test.py
index 6bbc8233..da9a78db 100644
--- a/python/google/protobuf/internal/descriptor_pool_test.py
+++ b/python/google/protobuf/internal/descriptor_pool_test.py
@@ -36,7 +36,10 @@ __author__ = 'matthewtoia@google.com (Matt Toia)'
import os
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import unittest_pb2
from google.protobuf import descriptor_pb2
from google.protobuf.internal import api_implementation
diff --git a/python/google/protobuf/internal/descriptor_test.py b/python/google/protobuf/internal/descriptor_test.py
index f94f9f14..99afee63 100755
--- a/python/google/protobuf/internal/descriptor_test.py
+++ b/python/google/protobuf/internal/descriptor_test.py
@@ -36,7 +36,10 @@ __author__ = 'robinson@google.com (Will Robinson)'
import sys
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import unittest_custom_options_pb2
from google.protobuf import unittest_import_pb2
from google.protobuf import unittest_pb2
@@ -391,7 +394,7 @@ class DescriptorTest(unittest.TestCase):
self.assertEqual(self.my_file.name, 'some/filename/some.proto')
self.assertEqual(self.my_file.package, 'protobuf_unittest')
- @test_util.skipIf(
+ @unittest.skipIf(
api_implementation.Type() != 'cpp' or api_implementation.Version() != 2,
'Immutability of descriptors is only enforced in v2 implementation')
def testImmutableCppDescriptor(self):
diff --git a/python/google/protobuf/internal/generator_test.py b/python/google/protobuf/internal/generator_test.py
index 7fcb1377..9956da59 100755
--- a/python/google/protobuf/internal/generator_test.py
+++ b/python/google/protobuf/internal/generator_test.py
@@ -41,7 +41,10 @@ further ensures that we can use Python protocol message objects as we expect.
__author__ = 'robinson@google.com (Will Robinson)'
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf.internal import test_bad_identifiers_pb2
from google.protobuf import unittest_custom_options_pb2
from google.protobuf import unittest_import_pb2
diff --git a/python/google/protobuf/internal/json_format_test.py b/python/google/protobuf/internal/json_format_test.py
index dddc2df8..4e2f35e4 100644
--- a/python/google/protobuf/internal/json_format_test.py
+++ b/python/google/protobuf/internal/json_format_test.py
@@ -38,7 +38,10 @@ import json
import math
import sys
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import json_format
from google.protobuf.util import json_format_proto3_pb2
diff --git a/python/google/protobuf/internal/message_factory_test.py b/python/google/protobuf/internal/message_factory_test.py
index 9ec54fff..d760b898 100644
--- a/python/google/protobuf/internal/message_factory_test.py
+++ b/python/google/protobuf/internal/message_factory_test.py
@@ -34,7 +34,10 @@
__author__ = 'matthewtoia@google.com (Matt Toia)'
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import descriptor_pb2
from google.protobuf.internal import factory_test1_pb2
from google.protobuf.internal import factory_test2_pb2
diff --git a/python/google/protobuf/internal/message_test.py b/python/google/protobuf/internal/message_test.py
index 604c426a..13c3caa6 100755
--- a/python/google/protobuf/internal/message_test.py
+++ b/python/google/protobuf/internal/message_test.py
@@ -52,7 +52,10 @@ import pickle
import six
import sys
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf.internal import _parameterized
from google.protobuf import map_unittest_pb2
from google.protobuf import unittest_pb2
diff --git a/python/google/protobuf/internal/proto_builder_test.py b/python/google/protobuf/internal/proto_builder_test.py
index e0467251..6a8644b0 100644
--- a/python/google/protobuf/internal/proto_builder_test.py
+++ b/python/google/protobuf/internal/proto_builder_test.py
@@ -37,7 +37,10 @@ try:
except ImportError:
from ordereddict import OrderedDict #PY26
import collections
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import descriptor_pb2
from google.protobuf import descriptor_pool
from google.protobuf import proto_builder
diff --git a/python/google/protobuf/internal/reflection_test.py b/python/google/protobuf/internal/reflection_test.py
index 6815c238..8621d61e 100755
--- a/python/google/protobuf/internal/reflection_test.py
+++ b/python/google/protobuf/internal/reflection_test.py
@@ -41,7 +41,10 @@ import operator
import six
import struct
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import unittest_import_pb2
from google.protobuf import unittest_mset_pb2
from google.protobuf import unittest_pb2
@@ -1623,7 +1626,7 @@ class ReflectionTest(unittest.TestCase):
self.assertFalse(proto.IsInitialized(errors))
self.assertEqual(errors, ['a', 'b', 'c'])
- @test_util.skipIf(
+ @unittest.skipIf(
api_implementation.Type() != 'cpp' or api_implementation.Version() != 2,
'Errors are only available from the most recent C++ implementation.')
def testFileDescriptorErrors(self):
@@ -2822,7 +2825,7 @@ class OptionsTest(unittest.TestCase):
class ClassAPITest(unittest.TestCase):
- @test_util.skipIf(
+ @unittest.skipIf(
api_implementation.Type() == 'cpp' and api_implementation.Version() == 2,
'C++ implementation requires a call to MakeDescriptor()')
def testMakeClassWithNestedDescriptor(self):
diff --git a/python/google/protobuf/internal/service_reflection_test.py b/python/google/protobuf/internal/service_reflection_test.py
index 564e2d1a..98614b77 100755
--- a/python/google/protobuf/internal/service_reflection_test.py
+++ b/python/google/protobuf/internal/service_reflection_test.py
@@ -34,7 +34,10 @@
__author__ = 'petar@google.com (Petar Petrov)'
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import unittest_pb2
from google.protobuf import service_reflection
from google.protobuf import service
diff --git a/python/google/protobuf/internal/symbol_database_test.py b/python/google/protobuf/internal/symbol_database_test.py
index 7fb4b56d..0cb935a8 100644
--- a/python/google/protobuf/internal/symbol_database_test.py
+++ b/python/google/protobuf/internal/symbol_database_test.py
@@ -32,7 +32,10 @@
"""Tests for google.protobuf.symbol_database."""
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import unittest_pb2
from google.protobuf import descriptor
from google.protobuf import symbol_database
diff --git a/python/google/protobuf/internal/test_util.py b/python/google/protobuf/internal/test_util.py
index 539236b4..ac88fa81 100755
--- a/python/google/protobuf/internal/test_util.py
+++ b/python/google/protobuf/internal/test_util.py
@@ -38,13 +38,6 @@ __author__ = 'robinson@google.com (Will Robinson)'
import os.path
-import sys
-# PY2.6 compatible skipIf
-if sys.version_info < (2, 7):
- from unittest2 import skipIf
-else:
- from unittest import skipIf
-
from google.protobuf import unittest_import_pb2
from google.protobuf import unittest_pb2
from google.protobuf import descriptor_pb2
diff --git a/python/google/protobuf/internal/text_encoding_test.py b/python/google/protobuf/internal/text_encoding_test.py
index 9e7b9ce4..338a287b 100755
--- a/python/google/protobuf/internal/text_encoding_test.py
+++ b/python/google/protobuf/internal/text_encoding_test.py
@@ -32,7 +32,10 @@
"""Tests for google.protobuf.text_encoding."""
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import text_encoding
TEST_VALUES = [
diff --git a/python/google/protobuf/internal/text_format_test.py b/python/google/protobuf/internal/text_format_test.py
index fb4addeb..cca0ee63 100755
--- a/python/google/protobuf/internal/text_format_test.py
+++ b/python/google/protobuf/internal/text_format_test.py
@@ -39,7 +39,10 @@ import re
import six
import string
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf.internal import _parameterized
from google.protobuf import map_unittest_pb2
diff --git a/python/google/protobuf/internal/unknown_fields_test.py b/python/google/protobuf/internal/unknown_fields_test.py
index 25b447e1..9685b8b4 100755
--- a/python/google/protobuf/internal/unknown_fields_test.py
+++ b/python/google/protobuf/internal/unknown_fields_test.py
@@ -35,7 +35,10 @@
__author__ = 'bohdank@google.com (Bohdan Koval)'
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import unittest_mset_pb2
from google.protobuf import unittest_pb2
from google.protobuf import unittest_proto3_arena_pb2
@@ -48,7 +51,7 @@ from google.protobuf.internal import type_checkers
def SkipIfCppImplementation(func):
- return test_util.skipIf(
+ return unittest.skipIf(
api_implementation.Type() == 'cpp' and api_implementation.Version() == 2,
'C++ implementation does not expose unknown fields to Python')(func)
diff --git a/python/google/protobuf/internal/wire_format_test.py b/python/google/protobuf/internal/wire_format_test.py
index 78dc1167..f659d18e 100755
--- a/python/google/protobuf/internal/wire_format_test.py
+++ b/python/google/protobuf/internal/wire_format_test.py
@@ -34,7 +34,10 @@
__author__ = 'robinson@google.com (Will Robinson)'
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import message
from google.protobuf.internal import wire_format