Skip to content

Commit

Permalink
fixture error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kszucs committed Sep 24, 2019
1 parent 2be25ce commit 00340ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion python/pyarrow/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
except ImportError:
pass
else:
initialize_s3()
initialize_s3()
22 changes: 12 additions & 10 deletions python/pyarrow/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,19 @@ def minio_server():
'MINIO_SECRET_KEY': secret_key
})

try:
with TemporaryDirectory() as tempdir:
args = ['minio', '--compat', 'server', '--quiet', '--address',
address, tempdir]
try:
proc = subprocess.Popen(args, env=env)
yield address, access_key, secret_key
finally:
with TemporaryDirectory() as tempdir:
args = ['minio', '--compat', 'server', '--quiet', '--address',
address, tempdir]
proc = None
try:
proc = subprocess.Popen(args, env=env)
except IOError:
pytest.skip('`minio` command cannot be located')
else:
yield address, access_key, secret_key
finally:
if proc is not None:
proc.kill()
except IOError:
pytest.skip('`minio` command cannot be located')


@pytest.fixture(scope='session')
Expand Down

0 comments on commit 00340ed

Please sign in to comment.