Skip to content

Commit

Permalink
sync back patch improvements from upstream PR 14832
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Jan 26, 2023
1 parent f47c48c commit 9dfdaf1
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 36 deletions.
2 changes: 1 addition & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ source:
- patches/0001-ARROW-18340-Python-PyArrow-C-header-files-no-longer-.patch
# switch off tests that require the as-yet unpackaged
# https://github.com/googleapis/storage-testbench
- patches/0002-definitely-skip-all-tests-requiring-gcs_server-fixtu.patch
- patches/0002-properly-skip-if-instantiation-of-gcs_server-gcfs-fi.patch
# testing-submodule not part of release tarball
- git_url: https://github.com/apache/arrow-testing.git
git_rev: 00c483283433b4c02cb811f260dbe35414c806a4
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
From 652c929e80cb53425027d225d3a858266b54360b Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Mon, 5 Dec 2022 20:15:58 +1100
Subject: [PATCH 2/2] properly skip if instantiation of gcs_server/gcfs fixture
fails

---
python/pyarrow/tests/conftest.py | 9 ++++++++-
python/pyarrow/tests/test_fs.py | 7 ++++---
2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/python/pyarrow/tests/conftest.py b/python/pyarrow/tests/conftest.py
index a06ac9209..db0df51ee 100644
--- a/python/pyarrow/tests/conftest.py
+++ b/python/pyarrow/tests/conftest.py
@@ -183,9 +183,16 @@ def gcs_server():
args = [sys.executable, '-m', 'testbench', '--port', str(port)]
proc = None
try:
+ # check first if testbench module is available
+ import testbench
+ # start server
proc = subprocess.Popen(args, env=env)
- except OSError as e:
+ # Make sure the server is alive.
+ assert proc.poll() is None
+ except (ModuleNotFoundError, OSError) as e:
pytest.skip(f"Command {args} failed to execute: {e}")
+ except AssertionError as e:
+ pytest.skip(f"Command {args} did not start server successfully: {e}")
else:
yield {
'connection': ('localhost', port),
diff --git a/python/pyarrow/tests/test_fs.py b/python/pyarrow/tests/test_fs.py
index 945114454..7380711b3 100644
--- a/python/pyarrow/tests/test_fs.py
+++ b/python/pyarrow/tests/test_fs.py
@@ -207,8 +207,6 @@ def gcsfs(request, gcs_server):

host, port = gcs_server['connection']
bucket = 'pyarrow-filesystem/'
- # Make sure the server is alive.
- assert gcs_server['process'].poll() is None

fs = GcsFileSystem(
endpoint_override=f'{host}:{port}',
@@ -217,7 +215,10 @@ def gcsfs(request, gcs_server):
anonymous=True,
retry_time_limit=timedelta(seconds=45)
)
- fs.create_dir(bucket)
+ try:
+ fs.create_dir(bucket)
+ except OSError as e:
+ pytest.skip(f"Could not create directory in {fs}: {e}")

yield dict(
fs=fs,
--
2.38.1.windows.1

0 comments on commit 9dfdaf1

Please sign in to comment.