Skip to content

Commit 6675399

Browse files
committed
ARROW-5596: [Python] Fix Python-3 syntax only in test_flight.py
Even though Flight is only available in Python 3, having Py3-only syntax is enough to break py.test Author: Wes McKinney <wesm+git@apache.org> Closes #4553 from wesm/ARROW-5596 and squashes the following commits: 7130d40 <Wes McKinney> Use pathlib backport 7f85e61 <Wes McKinney> Fix Python-3 syntax only in test_flight.py
1 parent ae57178 commit 6675399

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

cpp/build-support/lint_cpp_cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ def lint_files():
9898

9999
# Only run on header files
100100
if filename.endswith('.h'):
101-
yield from lint_file(full_path)
101+
for _ in lint_file(full_path):
102+
yield _
102103

103104

104105
if __name__ == '__main__':

python/pyarrow/tests/test_flight.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
import tempfile
2424
import threading
2525
import time
26+
import traceback
2627

2728
import pytest
2829

2930
import pyarrow as pa
3031

31-
from pathlib import Path
3232
from pyarrow.compat import tobytes
33-
33+
from pyarrow.util import pathlib
3434

3535
flight = pytest.importorskip("pyarrow.flight")
3636

@@ -40,7 +40,7 @@ def resource_root():
4040
if not os.environ.get("ARROW_TEST_DATA"):
4141
raise RuntimeError("Test resources not found; set "
4242
"ARROW_TEST_DATA to <repo root>/testing")
43-
return Path(os.environ["ARROW_TEST_DATA"]) / "flight"
43+
return pathlib.Path(os.environ["ARROW_TEST_DATA"]) / "flight"
4444

4545

4646
def read_flight_resource(path):
@@ -51,10 +51,11 @@ def read_flight_resource(path):
5151
try:
5252
with (root / path).open("rb") as f:
5353
return f.read()
54-
except FileNotFoundError as e:
54+
except FileNotFoundError:
5555
raise RuntimeError(
5656
"Test resource {} not found; did you initialize the "
57-
"test resource submodule?".format(root / path)) from e
57+
"test resource submodule?\n{}".format(root / path,
58+
traceback.format_exc()))
5859

5960

6061
def example_tls_certs():

0 commit comments

Comments
 (0)