Description:
Setting PYTHONPATH of the process running the unittest code should also
affect tests that run in a subprocess.
The downside of this change is that the subprocess tests no longer check
that everything will work by default once you've installed transitfeed.
Hopefully if your tests are using a customized sys.path you know what
you are doing.
Please review this at http://codereview.appspot.com/7469
Affected files:
M python/test/util.py
Index: python/test/util.py
===================================================================
--- python/test/util.py (revision 893)
+++ python/test/util.py (working copy)
@@ -92,9 +92,11 @@
transitfeed_parent = transitfeed_parent.replace("\\", "/").rstrip("/")
script_path = cmd[0].replace("\\", "/")
script_args = cmd[1:]
+ env = {"PYTHONPATH": ":".join(sys.path)}
cmd = [sys.executable,
"-c",
"import sys; sys.path.insert(0,'%s');exec(open('%s'))" %
(transitfeed_parent, script_path)] + script_args
- return check_call(cmd, expected_retcode=expected_retcode, shell=False)
+ return check_call(cmd, expected_retcode=expected_retcode, shell=False,
+ env=env)
http://codereview.appspot.com/7469/diff/1/2
File python/test/util.py (right):
http://codereview.appspot.com/7469/diff/1/2#newcode95
Line 95: env = {"PYTHONPATH": ":".join(sys.path)}
Could you add a comment here similar to what you wrote in the change
description?
http://codereview.appspot.com/7469/diff/1/2#newcode95
Line 95: env = {"PYTHONPATH": ":".join(sys.path)}
Could you add a comment here similar to what you wrote in the change
description?