소스 검색

Add code suggested by Michal Januszewski <michalj@gmail.com> to ensure that
Python tests run correctly even when a previous version of the library is
already installed. I was unable to reproduce his problem on my machine but
the fix seems harmless enough.

temporal 17 년 전
부모
커밋
bf86b546c3
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      python/setup.py

+ 5 - 0
python/setup.py

@@ -47,6 +47,11 @@ def generate_proto(source):
       sys.exit(-1)
 
 def MakeTestSuite():
+  # This is apparently needed on some systems to make sure that the tests
+  # work even if a previous version is already installed.
+  if 'google' in sys.modules:
+    del sys.modules['google']
+
   generate_proto("../src/google/protobuf/unittest.proto")
   generate_proto("../src/google/protobuf/unittest_import.proto")
   generate_proto("../src/google/protobuf/unittest_mset.proto")