Skip to content

Commit

Permalink
Skip old botocore; don't skip on moto; undo env vars in finally
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Dec 7, 2018
1 parent 186b215 commit 7682581
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pandas/tests/io/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from distutils.version import LooseVersion
import os

import pytest
Expand Down Expand Up @@ -40,17 +41,18 @@ def s3_resource(tips_file, jsonl_file):
"""
pytest.importorskip('s3fs')
boto3 = pytest.importorskip('boto3')
botocore = pytest.importorskip('botocore')

if LooseVersion(botocore.__version__) < LooseVersion("1.11.0"):
# botocore leaks an uncatchable ResourceWarning before 1.11.0;
# see GH 23731 and https://github.com/boto/botocore/issues/1464
pytest.skip("botocore is leaking resources before 1.11.0")

# temporary workaround as moto fails for botocore >= 1.11 otherwise
# see https://github.com/spulec/moto/issues/1924 & 1952
os.environ.setdefault("AWS_ACCESS_KEY_ID", "foobar_key")
os.environ.setdefault("AWS_SECRET_ACCESS_KEY", "foobar_secret")

# GH-24092. See if boto.plugin skips the test or fails.
try:
pytest.importorskip("boto.plugin")
except AttributeError:
raise pytest.skip("moto/moto error")
moto = pytest.importorskip('moto')

test_s3_files = [
Expand Down Expand Up @@ -83,3 +85,5 @@ def add_tips_files(bucket_name):
yield conn
finally:
s3.stop()
os.environ.setdefault("AWS_ACCESS_KEY_ID", None)
os.environ.setdefault("AWS_SECRET_ACCESS_KEY", None)

0 comments on commit 7682581

Please sign in to comment.