fixture error handling

This commit is contained in:
Krisztián Szűcs committed 2019-09-24 16:49:04 +02:00
1 parent 2be25ce291
commit 00340ed4c6
2 files changed
+13 -11

No files matched your search

+1 -1
View File
@@ -31,4 +31,4 @@ try:
except ImportError:
pass
else:
initialize_s3()
initialize_s3()
+12 -10
View File
@@ -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')