liormizr / s3path

s3path is a pathlib extension for AWS S3 Service
Apache License 2.0
208 stars 40 forks source link

The `rmdir` method can not delete buckets #117

Closed DerPhysikeR closed 1 year ago

DerPhysikeR commented 1 year ago

Hi and thank you for S3Path!

For a recent project I wanted to create temporary S3 buckets using S3Path. Unfortunately, S3Path doesn't seem to be able to delete buckets, although it can create them.

def test_rmdir_can_remove_buckets(s3_mock):
    s3 = boto3.resource('s3')
    bucket = S3Path('/test-bucket/')
    bucket.mkdir()
    assert bucket.exists()
    bucket.rmdir()
    assert not bucket.exists()

This test fails because bucket.rmdir() doesn't delete the bucket. Also, no error is raised although the removal fails.

I don't believe this is intended behavior.

liormizr commented 1 year ago

The fix is merged I'll update when we will create a new version

liormizr commented 1 year ago

Deployed in version 0.4.2