Commit dbea00ae authored by Jisi Liu's avatar Jisi Liu

Revert back changes to import unittest2 for py26

parent a783eaf3
......@@ -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
......
......@@ -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
......
......@@ -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):
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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):
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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 = [
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment