Skip to content

reset_default_storage_dir gets ignored through get_default_client #414

Description

@Quickblink
from cloudpathlib.local import LocalS3Path, LocalS3Client

path = LocalS3Path("s3://some/path/")
path.touch()
LocalS3Client.reset_default_storage_dir()
new_path = LocalS3Path("s3://some/path/")
assert not new_path.is_file() # fails

The reason is that reset_default_storage_dir() acts on the class attribute only and not on the instance attribute of the LocalClient in question. Because of Client.get_default_client() returning the same client instance for any path (saved as a class attribute), no new client gets instantiated to make use of the new directory. The tests don’t catch that because they create the clients explicitly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions