Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: appengine/path_mangler_hack.py

Issue 499103002: Make test_results deployable again. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: merge to ToT Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « appengine/chromium_cq_status/tests/utils_test.py ('k') | appengine/test_results/__init__.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import sys
6
7 # App Engine source file imports must be relative to their app's root.
8 # Provide a way to mangle sys.path, but not leave it littered with junk.
9
10 # TODO(ojan): This is a stopgap. Come up with a more general solution.
11
12 # pylint: disable=W0702
13
14 class PathMangler: # pragma: no cover
15 def __init__(self, root):
16 self.app_root = root
17
18 def __enter__(self):
19 sys.path.append(self.app_root)
20
21 try:
22 import model
23 reload(model)
24 except:
25 pass
26
27 try:
28 import handlers
29 reload(handlers)
30 except:
31 pass
32
33 def __exit__(self, etype, value, etraceback):
34 sys.path.remove(self.app_root)
OLDNEW
« no previous file with comments | « appengine/chromium_cq_status/tests/utils_test.py ('k') | appengine/test_results/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698