From c5808be0dbe1264324356f1246830a5ec5f64b28 Mon Sep 17 00:00:00 2001 From: Peter Bull Date: Wed, 14 Aug 2024 14:54:43 -0700 Subject: [PATCH] Change reset path for default --- cloudpathlib/local/localclient.py | 4 ++-- tests/test_cloudpath_instantiation.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cloudpathlib/local/localclient.py b/cloudpathlib/local/localclient.py index 627b8e1f..d9a7ee1b 100644 --- a/cloudpathlib/local/localclient.py +++ b/cloudpathlib/local/localclient.py @@ -50,8 +50,8 @@ def get_default_storage_dir(cls) -> Path: def reset_default_storage_dir(cls) -> Path: cls._default_storage_temp_dir = None - # Also reset default client so it gets recreated with new temp dir - cls._default_client = None + # Also reset storage on default client so it uses the new temp dir + cls.get_default_client()._local_storage_dir = cls.get_default_storage_dir() return cls.get_default_storage_dir() diff --git a/tests/test_cloudpath_instantiation.py b/tests/test_cloudpath_instantiation.py index b625a47b..64951495 100644 --- a/tests/test_cloudpath_instantiation.py +++ b/tests/test_cloudpath_instantiation.py @@ -92,6 +92,9 @@ def test_dependencies_not_loaded(rig, monkeypatch): with pytest.raises(MissingDependenciesError): rig.create_cloud_path("dir_0/file0_0.txt") + # manual reset for teardown order so teardown doesn't fail + monkeypatch.setattr(rig.path_class._cloud_meta, "dependencies_loaded", True) + def test_is_pathlike(rig): p = rig.create_cloud_path("dir_0")