Skip to content

Commit

Permalink
conditional import of test dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
kszucs committed Sep 24, 2019
1 parent efa05d2 commit 2cb19d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions python/pyarrow/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,19 +246,22 @@ def minio_server():
minio_dir = os.environ.get('S3FS_DIR', '')
minio_bin = os.path.join(minio_dir, 'minio') if minio_dir else 'minio'

with tempfile.TemporaryDirectory() as tempdir:
args = [minio_bin, '--compat', 'server', '--quiet', '--address',
address, tempdir]
with subprocess.Popen(args, env=env) as proc:
yield address, access_key, secret_key
proc.terminate()
try:
with tempfile.TemporaryDirectory() as tempdir:
args = [minio_bin, '--compat', 'server', '--quiet', '--address',
address, tempdir]
with subprocess.Popen(args, env=env) as proc:
yield address, access_key, secret_key
proc.terminate()
except IOError:
pytest.skip('`minio` command cannot be located, try to set S3FS_DIR')


@pytest.fixture(scope='module')
def minio_client(minio_server):
from minio import Minio
minio = pytest.importorskip('minio')
address, access_key, secret_key = minio_server
return Minio(
return minio.Minio(
address,
access_key=access_key,
secret_key=secret_key,
Expand Down
2 changes: 1 addition & 1 deletion python/pyarrow/tests/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ def test_filters_read_table(tempdir):

@pytest.fixture
def s3_example(minio_server, minio_bucket):
import s3fs
s3fs = pytest.importorskip('s3fs')

address, access_key, secret_key = minio_server
bucket_name = minio_bucket
Expand Down

0 comments on commit 2cb19d1

Please sign in to comment.