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

Unified Diff: appengine/findit/util_scripts/__init__.py

Issue 2435863003: [Findit] Add local git parsers. (Closed)
Patch Set: Fix nits. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: appengine/findit/util_scripts/__init__.py
diff --git a/appengine/findit/util_scripts/__init__.py b/appengine/findit/util_scripts/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..785595c83a0b902b0de05bfc87e13fc1e992e295
--- /dev/null
+++ b/appengine/findit/util_scripts/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import sys
+
+
+_THIS_DIR = os.path.dirname(os.path.realpath(__file__))
+
+# TODO(katesonia): Figure out why os.getenv('APPLICATION_ID') always return
+# True for local unittest.
+#
+# This hack is due to testing setup and code structure.
+#
+# In testing setup, the root directory appengine/findit would be the current
+# working directory during execution of unittests; and it is automatically
+# added to sys.path or PYTHONPATH.
+#
+# The util_scripts/ are stand-alone local scripts and all the imports start
+# from util_scripts, so added this util_scripts/ directory as working
stgao 2016/11/08 21:44:16 What's "working directory"? This sounds incorrect
Sharu Jiang 2016/11/10 22:28:37 I think the working directory here is the "current
stgao 2016/11/10 22:33:47 I'm confused with the terms here. But you may want
Sharu Jiang 2016/11/11 21:07:09 Done.
+# directory.
+sys.path.insert(0, _THIS_DIR)
+
+# This hack is because the appengine_config.py is loaded by the testing setup
+# only if it is in the root directory appengine/findit.
+import appengine_config
stgao 2016/11/08 21:44:16 Why we have this here? Do you understand why it is
Sharu Jiang 2016/11/10 22:28:37 Done.

Powered by Google App Engine
This is Rietveld 408576698