(bucket=test_bucket_name, files=files)
| 124 | |
| 125 | @contextmanager |
| 126 | def s3_context(bucket=test_bucket_name, files=files): |
| 127 | client = boto3.client("s3", endpoint_url=endpoint_uri) |
| 128 | client.create_bucket(Bucket=bucket, ACL="public-read-write") |
| 129 | for f, data in files.items(): |
| 130 | client.put_object(Bucket=bucket, Key=f, Body=data) |
| 131 | fs = s3fs.S3FileSystem( |
| 132 | anon=True, client_kwargs={"endpoint_url": "http://127.0.0.1:5555/"} |
| 133 | ) |
| 134 | s3fs.S3FileSystem.clear_instance_cache() |
| 135 | fs.invalidate_cache() |
| 136 | try: |
| 137 | yield fs |
| 138 | finally: |
| 139 | fs.rm(bucket, recursive=True) |
| 140 | |
| 141 | |
| 142 | @pytest.fixture() |
no test coverage detected
searching dependent graphs…