Skip to content

CI for boto: fix errors; add coverage; add skip for uncatchable ResourceWarning #23731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Dec 15, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/deps/travis-36.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ channels:
- conda-forge
dependencies:
- beautifulsoup4
- botocore>=1.11
- cython>=0.28.2
- dask
- fastparquet
Expand Down
4 changes: 4 additions & 0 deletions ci/deps/travis-37.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ channels:
- c3i_test
dependencies:
- python=3.7
- botocore>=1.11
- cython>=0.28.2
- numpy
- python-dateutil
Expand All @@ -14,3 +15,6 @@ dependencies:
- pytest
- pytest-xdist
- hypothesis>=3.58.0
- s3fs
- pip:
- moto
12 changes: 9 additions & 3 deletions pandas/tests/io/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import os

import pytest

from pandas.io.parsers import read_csv


Expand Down Expand Up @@ -37,6 +40,12 @@ def s3_resource(tips_file, jsonl_file):
"""
pytest.importorskip('s3fs')
boto3 = pytest.importorskip('boto3')

# temporary workaround as moto fails for botocore >= 1.11 otherwise
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is affecting global state. can you remove these in the finally (or use a context manager)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

# 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")
Expand All @@ -59,7 +68,6 @@ def add_tips_files(bucket_name):
Body=f)

try:

s3 = moto.mock_s3()
s3.start()

Expand All @@ -73,7 +81,5 @@ def add_tips_files(bucket_name):
conn.create_bucket(Bucket='cant_get_it', ACL='private')
add_tips_files('cant_get_it')
yield conn
except: # noqa: flake8
pytest.skip("failure to use s3 resource")
finally:
s3.stop()