Metadata-Version: 2.3
Name: s3-testing
Version: 0.0.1
Summary: S3 testing helpers
Author: Oliver Russell
Author-email: Oliver Russell <mrxoliver@gmail.com>
License: MIT License
         
         Copyright (c) 2023 Oliver Russell
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Requires-Dist: rclone-binaries
Requires-Python: >=3.12
Project-URL: homepage, https://github.com/leontrolski/s3-testing
Project-URL: documentation, https://github.com/leontrolski/s3-testing
Project-URL: repository, https://github.com/leontrolski/s3-testing.git
Description-Content-Type: text/markdown

# S3 testing

Simple S3 helper for testing with Python - no docker, brew, apt, etc - uses [rclone-binaries](https://github.com/leontrolski/rclone-binaries) (turns out [rclone has an S3 server baked in](https://rclone.org/commands/rclone_serve_s3/)). Pairs nicely with [postgresql-testing](https://github.com/leontrolski/postgresql-testing).

It's super dumb, just:

```shell
pip install s3-testing
```

```python
import s3_testing

with s3_testing.serve() as config:
    s3 = boto3.client(**config.as_boto_kwargs)

    s3.create_bucket(Bucket="my-bucket")
    s3.put_object(
        Bucket="my-bucket",
        Key="hello.txt",
        Body=b"Hello from Python!",
    )
```

The default config puts all the data in `.s3-testing` - pop this in your `.gitignore`.

If you want a `pytest` fixture that gives you empty buckets, just [`shutil.rmtree(config.dir)`](test.py) between tests.

It has no auth, pass in whatever creds.

On my machine:

- Spinning up the server til it responds takes 700ms.
- Creating a bucket takes 1ms.
- Writing then reading a small object takes 3ms.
