Chromium Code Reviews| Index: appengine/swarming/swarming_bot/test_env_bot.py |
| diff --git a/appengine/swarming/swarming_bot/test_env_bot.py b/appengine/swarming/swarming_bot/test_env_bot.py |
| index 25f7954d5d551a91e0fe443eab4a16bf3c3dfe37..44158d21585e9ec0143cec2e11c369eeb7b0e69a 100644 |
| --- a/appengine/swarming/swarming_bot/test_env_bot.py |
| +++ b/appengine/swarming/swarming_bot/test_env_bot.py |
| @@ -36,8 +36,8 @@ def init_symlinks(root): |
| def setup_test_env(): |
| """Sets up the environment for bot tests.""" |
| init_symlinks(BOT_DIR) |
| - client_tests = os.path.normpath( |
| - os.path.join(BOT_DIR, '..', '..', '..', 'client', 'tests')) |
| + client = os.path.normpath(os.path.join(BOT_DIR, '..', '..', '..', 'client')) |
| + client_tests = os.path.join(client, 'tests') |
| sys.path.insert(0, client_tests) |
| tp = os.path.join(BOT_DIR, 'third_party') |
| @@ -53,3 +53,19 @@ def setup_test_env(): |
| # For python-rsa. |
| sys.path.insert(0, os.path.join(tp, 'rsa')) |
| sys.path.insert(0, os.path.join(tp, 'pyasn1')) |
| + |
| + # Protobuf is now used in the bot itself. |
| + # See fix_protobuf_package() in appengine/components/components/utils.py |
| + # but until this code, the version under client is used. |
| + if 'google' in sys.modules: |
| + # It may be in lib/python2.7/site-packages/google, take not chance and flush |
| + # it out. |
| + del sys.modules['google'] |
| + # This should import client/third_party/google |
| + import google |
| + protobuf_pkg = os.path.join(client, 'third_party', 'protobuf', 'google') |
|
dsansome
2017/03/17 01:54:55
This should just be os.path.join(client, 'third_pa
M-A Ruel
2017/03/24 20:12:52
Done.
|
| + if protobuf_pkg not in google.__path__: |
| + google.__path__.append(protobuf_pkg) |
|
dsansome
2017/03/17 01:54:55
This needs to be insert(0, ...)
M-A Ruel
2017/03/24 20:12:52
Done.
|
| + six_path = os.path.join(client, 'third_party', 'six') |
| + if six_path not in sys.path: |
| + sys.path.insert(0, six_path) |