diff --git a/snakemake/io.py b/snakemake/io.py index 08987f9a0..36cc05a74 100755 --- a/snakemake/io.py +++ b/snakemake/io.py @@ -96,6 +96,7 @@ def lutime(f, times): def lchmod(f, mode): os.chmod(f, mode, follow_symlinks=False) + else: def lchmod(f, mode): diff --git a/snakemake/remote/GS.py b/snakemake/remote/GS.py index ea92e7994..d17135ad8 100644 --- a/snakemake/remote/GS.py +++ b/snakemake/remote/GS.py @@ -206,8 +206,10 @@ def exists(self): return True elif any(self.directory_entries()): return True - else: - return False + + # The blob object can get out of sync, one last try! + self.update_blob() + return self.blob.exists() @retry.Retry(predicate=google_cloud_retry_predicate) def mtime(self): diff --git a/tests/conftest.py b/tests/conftest.py index 2671d16ea..01f08aa9e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,7 +9,9 @@ skip_on_windows = pytest.mark.skipif(ON_WINDOWS, reason="Unix stuff") only_on_windows = pytest.mark.skipif(not ON_WINDOWS, reason="Windows stuff") -needs_strace = pytest.mark.xfail(os.system("strace -o /dev/null true") != 0, reason="Missing strace") +needs_strace = pytest.mark.xfail( + os.system("strace -o /dev/null true") != 0, reason="Missing strace" +) @pytest.fixture(autouse=True) diff --git a/tests/test_google_lifesciences.py b/tests/test_google_lifesciences.py index 71fe2cc78..63a75a410 100644 --- a/tests/test_google_lifesciences.py +++ b/tests/test_google_lifesciences.py @@ -28,6 +28,7 @@ def cleanup_google_storage(prefix, bucket_name="snakemake-testing", restrict_to= Arguments: prefix (str) : the "subfolder" or prefix for some files in the buckets bucket_name (str) : the name of the bucket, default snakemake-testing + restrict_to (list) : only delete files in these paths (None deletes all) """ client = storage.Client() bucket = client.get_bucket(bucket_name) diff --git a/tests/test_io.py b/tests/test_io.py index 9b6745143..e9d0c8254 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -104,8 +104,11 @@ def __repr__(self): ) == sorted(["a: aa + b: b", "a: aa + b: bb", "c: c", "c: cc"]) # expand on pathlib.Path objects - assert expand( - PosixPath() / "{x}" / "{y}", - x="Hello", - y="world", - ) == ["Hello/world"] + assert ( + expand( + PosixPath() / "{x}" / "{y}", + x="Hello", + y="world", + ) + == ["Hello/world"] + ) diff --git a/tests/testapi.py b/tests/testapi.py index b06a0b9d5..e3904ac78 100644 --- a/tests/testapi.py +++ b/tests/testapi.py @@ -72,4 +72,11 @@ def test_dicts_in_config(): ), file=f, ) - snakemake(path, workdir=tmpdir, config={"this_option": "does_not_break", "test": {'this_dict':'shoult_not_either'}}) + snakemake( + path, + workdir=tmpdir, + config={ + "this_option": "does_not_break", + "test": {"this_dict": "shoult_not_either"}, + }, + )