merge tags/2.6.0 into trunk
diff --git a/python/README.txt b/python/README.txt
index 4ed9bc0..9ba42f8 100644
--- a/python/README.txt
+++ b/python/README.txt
@@ -47,9 +47,9 @@
 
      $ python setup.py build
      $ python setup.py google_test
-     
+
      if you want to test c++ implementation, run:
-     $ python setup.py google_test --cpp_implementation
+     $ python setup.py test
 
    If some tests fail, this library may not work correctly on your
    system.  Continue at your own risk.
@@ -66,7 +66,7 @@
 
      $ python setup.py install
      or:
-     $ python setup.py install --cpp_implementation
+     $ python setup.py install --nocpp_implementation
 
    This step may require superuser privileges.
    NOTE: To use C++ implementation, you need to install C++ protobuf runtime
@@ -101,8 +101,7 @@
 install the extension.  You must also set the variable at runtime, otherwise
 the pure-Python implementation will be used. In a future release, we will
 change the default so that C++ implementation is used whenever it is available.
-It is strongly recommended to run `python setup.py google_test
---cpp_implementation` after setting the
+It is strongly recommended to run `python setup.py test` after setting the
 variable to "cpp", so the tests will be against C++ implemented Python
 messages.
 
diff --git a/python/google/protobuf/internal/reflection_test.py b/python/google/protobuf/internal/reflection_test.py
index 587246a..b3c414c 100755
--- a/python/google/protobuf/internal/reflection_test.py
+++ b/python/google/protobuf/internal/reflection_test.py
@@ -41,7 +41,6 @@
 import gc
 import operator
 import struct
-import sys
 
 from google.apputils import basetest
 from google.protobuf import unittest_import_pb2
@@ -1557,20 +1556,7 @@
 
   def assertNotInitialized(self, proto):
     self.assertFalse(proto.IsInitialized())
-    try:
-      proto.SerializeToString()
-    except message.EncodeError:
-      return
-    except:
-      # C++ implementation in opensource do not consider the catched
-      # exception google.protobuf.message.EncodeError same as
-      # message.EncodeError. Add an additional catch to deal with it.
-      if api_implementation.Type() == 'python':
-        raise self.failureException('message.EncodeError not raised')
-      self.assertEqual('<class \'google.protobuf.message.EncodeError\'>',
-                       str(sys.exc_info()[0]))
-    else:
-      raise self.failureException('message.EncodeError not raised')
+    self.assertRaises(message.EncodeError, proto.SerializeToString)
     # "Partial" serialization doesn't care if message is uninitialized.
     proto.SerializePartialToString()
 
@@ -2500,13 +2486,6 @@
       # Check if the exception message is the right one.
       self.assertEqual(exception, str(ex))
       return
-    except:
-      # C++ implementation in opensource do not consider the catched
-      # exception google.protobuf.message.EncodeError same as
-      # message.EncodeError. Add an additional catch to deal with it.
-      if api_implementation.Type() == 'python':
-        raise self.failureException('%s not raised' % str(exc_class))
-      self.assertEqual(exception, str(sys.exc_info()[1]))
     else:
       raise self.failureException('%s not raised' % str(exc_class))
 
diff --git a/python/google/protobuf/pyext/__init__.py b/python/google/protobuf/pyext/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/python/google/protobuf/pyext/__init__.py
diff --git a/python/setup.py b/python/setup.py
index 51b27d7..6eecd48 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -83,6 +83,23 @@
   generate_proto("google/protobuf/internal/factory_test2.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
+
 class clean(_clean):
   def run(self):
     # Delete generated files in the code tree.
@@ -119,14 +136,14 @@
   # release that are subject to conversion.
   # See code reference in previous code review.
 
-
 if __name__ == '__main__':
-  # C++ implementation extension
-  cpp_impl = '--cpp_implementation'
-  if cpp_impl in sys.argv:
+  ext_module_list = []
+  nocpp = '--nocpp_implementation'
+  if nocpp in sys.argv:
     sys.argv.remove(cpp_impl)
-    test_dir = "google/protobuf/pyext"
-    ext_module_list = [Extension(
+  else:
+    # C++ implementation extension
+    ext_module_list.append(Extension(
         "google.protobuf.pyext._message",
         [ "google/protobuf/pyext/descriptor.cc",
           "google/protobuf/pyext/message.cc",
@@ -134,20 +151,17 @@
           "google/protobuf/pyext/repeated_scalar_container.cc",
           "google/protobuf/pyext/repeated_composite_container.cc" ],
         define_macros=[('GOOGLE_PROTOBUF_HAS_ONEOF', '1')],
-        include_dirs = [ ".", "../src" ],
+        include_dirs = [ ".", "../src"],
         libraries = [ "protobuf" ],
         library_dirs = [ '../src/.libs' ],
-        )]
-  else:
-    test_dir = "google/protobuf/internal"
-    ext_module_list = []
-
+        ))
 
   setup(name = 'protobuf',
-        version = '2.6-pre',
+        version = '2.6.0',
         packages = [ 'google' ],
         namespace_packages = [ 'google' ],
-        google_test_dir = test_dir,
+        test_suite = 'setup.MakeTestSuite',
+        google_test_dir = "google/protobuf/internal",
         # Must list modules explicitly so that we don't install tests.
         py_modules = [
           'google.protobuf.internal.api_implementation',