This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e87f77  ARROW-2131: [Python] Prepend module path to PYTHONPATH when 
spawning subprocess
3e87f77 is described below

commit 3e87f7753a252d1e76187894bb294954e45a93ee
Author: Wes McKinney <wes.mckin...@twosigma.com>
AuthorDate: Thu Feb 22 12:09:39 2018 -0500

    ARROW-2131: [Python] Prepend module path to PYTHONPATH when spawning 
subprocess
    
    This enables this test to pass in an in-place build without running 
`setup.py develop`
    
    Author: Wes McKinney <wes.mckin...@twosigma.com>
    
    Closes #1640 from wesm/ARROW-2131 and squashes the following commits:
    
    460ded1b [Wes McKinney] Use more idiomatic option for getting module parent 
directory
    faa247af [Wes McKinney] Prepend development module path when spawning 
subprocess in test_serialization.py
---
 python/pyarrow/tests/test_serialization.py | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/python/pyarrow/tests/test_serialization.py 
b/python/pyarrow/tests/test_serialization.py
index 0917172..feccebb 100644
--- a/python/pyarrow/tests/test_serialization.py
+++ b/python/pyarrow/tests/test_serialization.py
@@ -580,6 +580,22 @@ def test_deserialize_in_different_process():
     p.join()
 
 
+def _get_modified_env_with_pythonpath():
+    # Prepend pyarrow root directory to PYTHONPATH
+    env = os.environ.copy()
+    existing_pythonpath = env.get('PYTHONPATH', '')
+    if sys.platform == 'win32':
+        sep = ';'
+    else:
+        sep = ':'
+
+    module_path = os.path.abspath(
+        os.path.dirname(os.path.dirname(pa.__file__)))
+
+    env['PYTHONPATH'] = sep.join((module_path, existing_pythonpath))
+    return env
+
+
 def test_deserialize_buffer_in_different_process():
     import tempfile
     import subprocess
@@ -589,9 +605,12 @@ def test_deserialize_buffer_in_different_process():
     f.write(b.to_pybytes())
     f.close()
 
+    subprocess_env = _get_modified_env_with_pythonpath()
+
     dir_path = os.path.dirname(os.path.realpath(__file__))
     python_file = os.path.join(dir_path, 'deserialize_buffer.py')
-    subprocess.check_call([sys.executable, python_file, f.name])
+    subprocess.check_call([sys.executable, python_file, f.name],
+                          env=subprocess_env)
 
 
 def test_set_pickle():

-- 
To stop receiving notification emails like this one, please contact
w...@apache.org.

Reply via email to