forked from luci/luci-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_env.py
More file actions
44 lines (32 loc) · 999 Bytes
/
test_env.py
File metadata and controls
44 lines (32 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
import logging
import os
import sys
import unittest
# config/
APP_DIR = os.path.dirname(os.path.realpath(os.path.abspath(__file__)))
# config/components/third_party
THIRD_PARTY = os.path.join(APP_DIR, 'components', 'third_party')
def setup_test_env():
"""Sets up App Engine test environment."""
sys.path.insert(0, APP_DIR)
from test_support import test_env
test_env.setup_test_env()
sys.path.insert(0, THIRD_PARTY)
from components import utils
utils.fix_protobuf_package()
def main():
if '-v' in sys.argv:
unittest.TestCase.maxDiff = None
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.FATAL)
unittest.main()
def future(result):
# Assume setup_test_env was called.
from google.appengine.ext import ndb
f = ndb.Future()
f.set_result(result)
return f