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 f3f91b0 ARROW-2263: [Python] Prepend local pyarrow/ path to
PYTHONPATH in test_cython.py
f3f91b0 is described below
commit f3f91b0cc43d2d5da1e17095aa04202e7776cf27
Author: Wes McKinney <[email protected]>
AuthorDate: Thu Mar 8 23:04:18 2018 -0500
ARROW-2263: [Python] Prepend local pyarrow/ path to PYTHONPATH in
test_cython.py
Author: Wes McKinney <[email protected]>
Closes #1730 from wesm/ARROW-2263 and squashes the following commits:
6b3f827c <Wes McKinney> Prepend local pyarrow/ path to PYTHONPATH in
test_cython.py
---
python/pyarrow/tests/test_cython.py | 8 +++++++-
python/pyarrow/tests/test_serialization.py | 16 +++-------------
python/pyarrow/tests/util.py | 17 ++++++++++++++++-
3 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/python/pyarrow/tests/test_cython.py
b/python/pyarrow/tests/test_cython.py
index df5e70e..57dbeb5 100644
--- a/python/pyarrow/tests/test_cython.py
+++ b/python/pyarrow/tests/test_cython.py
@@ -24,6 +24,7 @@ import pytest
import pyarrow as pa
+import pyarrow.tests.util as test_util
here = os.path.dirname(os.path.abspath(__file__))
@@ -85,9 +86,14 @@ def test_cython_api(tmpdir):
with open('setup.py', 'w') as f:
f.write(setup_code)
+ # ARROW-2263: Make environment with this pyarrow/ package first on the
+ # PYTHONPATH, for local dev environments
+ subprocess_env = test_util.get_modified_env_with_pythonpath()
+
# Compile extension module
subprocess.check_call([sys.executable, 'setup.py',
- 'build_ext', '--inplace'])
+ 'build_ext', '--inplace'],
+ env=subprocess_env)
# Check basic functionality
orig_path = sys.path[:]
diff --git a/python/pyarrow/tests/test_serialization.py
b/python/pyarrow/tests/test_serialization.py
index c174084..64aab06 100644
--- a/python/pyarrow/tests/test_serialization.py
+++ b/python/pyarrow/tests/test_serialization.py
@@ -28,6 +28,8 @@ import sys
import pyarrow as pa
import numpy as np
+import pyarrow.tests.util as test_util
+
try:
import torch
except ImportError:
@@ -624,18 +626,6 @@ 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', '')
-
- module_path = os.path.abspath(
- os.path.dirname(os.path.dirname(pa.__file__)))
-
- env['PYTHONPATH'] = os.pathsep.join((module_path, existing_pythonpath))
- return env
-
-
def test_deserialize_buffer_in_different_process():
import tempfile
import subprocess
@@ -645,7 +635,7 @@ def test_deserialize_buffer_in_different_process():
f.write(b.to_pybytes())
f.close()
- subprocess_env = _get_modified_env_with_pythonpath()
+ subprocess_env = test_util.get_modified_env_with_pythonpath()
dir_path = os.path.dirname(os.path.realpath(__file__))
python_file = os.path.join(dir_path, 'deserialize_buffer.py')
diff --git a/python/pyarrow/tests/util.py b/python/pyarrow/tests/util.py
index a3ba900..8c8d23b 100644
--- a/python/pyarrow/tests/util.py
+++ b/python/pyarrow/tests/util.py
@@ -19,9 +19,12 @@
Utility functions for testing
"""
+import contextlib
import decimal
+import os
import random
-import contextlib
+
+import pyarrow as pa
def randsign():
@@ -91,3 +94,15 @@ def randdecimal(precision, scale):
return decimal.Decimal(
'{}.{}'.format(whole, str(fractional).rjust(scale, '0'))
)
+
+
+def get_modified_env_with_pythonpath():
+ # Prepend pyarrow root directory to PYTHONPATH
+ env = os.environ.copy()
+ existing_pythonpath = env.get('PYTHONPATH', '')
+
+ module_path = os.path.abspath(
+ os.path.dirname(os.path.dirname(pa.__file__)))
+
+ env['PYTHONPATH'] = os.pathsep.join((module_path, existing_pythonpath))
+ return env
--
To stop receiving notification emails like this one, please contact
[email protected].