OLD | NEW |
1 # Copyright 2013 The Swarming Authors. All rights reserved. | 1 # Copyright 2013 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed by the Apache v2.0 license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import sys | 6 import sys |
7 | 7 |
8 # /appengine/ | 8 # /appengine/ |
9 ROOT_DIR = os.path.dirname( | 9 ROOT_DIR = os.path.dirname( |
10 os.path.dirname(os.path.realpath(os.path.abspath(__file__)))) | 10 os.path.dirname(os.path.realpath(os.path.abspath(__file__)))) |
11 | 11 |
12 _INITIALIZED = False | 12 _INITIALIZED = False |
13 | 13 |
14 | 14 |
15 def setup_test_env(): | 15 def setup_test_env(): |
16 """Sets up App Engine/Django test environment.""" | 16 """Sets up App Engine/Django test environment.""" |
17 global _INITIALIZED | 17 global _INITIALIZED |
18 if _INITIALIZED: | 18 if _INITIALIZED: |
19 raise Exception('Do not call test_env.setup_test_env() twice.') | 19 raise Exception('Do not call test_env.setup_test_env() twice.') |
20 _INITIALIZED = True | 20 _INITIALIZED = True |
21 | 21 |
22 # For 'from components import ...' and 'from test_support import ...'. | 22 # For 'from components import ...' and 'from test_support import ...'. |
23 sys.path.insert(0, ROOT_DIR) | 23 sys.path.insert(0, ROOT_DIR) |
24 sys.path.insert(0, os.path.join(ROOT_DIR, '..', 'third_party_local')) | 24 sys.path.insert(0, os.path.join(ROOT_DIR, '..', 'third_party_local')) |
25 | 25 |
26 from tool_support import gae_sdk_utils | 26 from tool_support import gae_sdk_utils |
27 gae_sdk_utils.setup_gae_env() | 27 gae_sdk_utils.setup_gae_env() |
28 gae_sdk_utils.setup_env(None, 'sample-app', 'v1a', None) | 28 gae_sdk_utils.setup_env(None, 'sample-app', 'v1a', None) |
OLD | NEW |