Skip to content

Commit 7682581

Browse files
committed
Skip old botocore; don't skip on moto; undo env vars in finally
1 parent 186b215 commit 7682581

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pandas/tests/io/conftest.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from distutils.version import LooseVersion
12
import os
23

34
import pytest
@@ -40,17 +41,18 @@ def s3_resource(tips_file, jsonl_file):
4041
"""
4142
pytest.importorskip('s3fs')
4243
boto3 = pytest.importorskip('boto3')
44+
botocore = pytest.importorskip('botocore')
45+
46+
if LooseVersion(botocore.__version__) < LooseVersion("1.11.0"):
47+
# botocore leaks an uncatchable ResourceWarning before 1.11.0;
48+
# see GH 23731 and https://github.com/boto/botocore/issues/1464
49+
pytest.skip("botocore is leaking resources before 1.11.0")
4350

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

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

5658
test_s3_files = [
@@ -83,3 +85,5 @@ def add_tips_files(bucket_name):
8385
yield conn
8486
finally:
8587
s3.stop()
88+
os.environ.setdefault("AWS_ACCESS_KEY_ID", None)
89+
os.environ.setdefault("AWS_SECRET_ACCESS_KEY", None)

0 commit comments

Comments
 (0)