[PATCH] test: test_python: set PYTHONPATH for the duration python is executed
Tomi Ollila
tomi.ollila at iki.fi
Fri Apr 15 14:18:14 PDT 2016
Set PYTHONPATH for the duration python is executed so environment is
not changed. This also allows appending the old value of PYTHONPATH
to it in case it is set (otherwise it would have been append again and
again when test_python is called).
At the same time, use -B option to avoid writing .pyc files to
bindings/python/* (which are not cleared out by distclean).
Drop the (unused) prefix code which preserved the original stdout of the
python program and opened sys.stdout to OUTPUT. In place of that there
is now note how (debug) information can be printed to original stdout.
---
when doing LD_LIBRARY_PATH this kept irritating me -- and it looks like
this is the last place where environment is changed (using export)
in mid-execution.
test/test-lib.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 562fde7b8878..5560a9dac3db 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1164,10 +1164,10 @@ test_emacs () {
}
test_python() {
- export PYTHONPATH=$TEST_DIRECTORY/../bindings/python
-
- (echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 'w')"; cat) \
- | $NOTMUCH_PYTHON -
+ # Note: if there is need to print debug information from python program,
+ # use stdout = os.fdopen(6, 'w') or stderr = os.fdopen(7, 'w')
+ PYTHONPATH="$TEST_DIRECTORY/../bindings/python${PYTHONPATH:+:$PYTHONPATH}" \
+ $NOTMUCH_PYTHON -B - > OUTPUT
}
test_ruby() {
--
2.6.4
More information about the notmuch
mailing list