Skip to content

Commit 3cdd940

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a844708 commit 3cdd940

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

tests/pickle_tests/test_pickle_core.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -725,12 +725,11 @@ def mock_func():
725725

726726
core.set_func(mock_func)
727727

728-
with patch("cachier.cores.pickle.os.fsync", side_effect=OSError("fsync failed")), pytest.raises(
729-
OSError, match="fsync failed"
728+
with (
729+
patch("cachier.cores.pickle.os.fsync", side_effect=OSError("fsync failed")),
730+
pytest.raises(OSError, match="fsync failed"),
730731
):
731-
core._save_cache(
732-
{"key": CacheEntry(value="value", time=datetime.now(), stale=False, _processing=False)}
733-
)
732+
core._save_cache({"key": CacheEntry(value="value", time=datetime.now(), stale=False, _processing=False)})
734733

735734
assert list(tmp_path.iterdir()) == []
736735

@@ -751,14 +750,13 @@ def mock_func():
751750

752751
core.set_func(mock_func)
753752

754-
with patch("cachier.cores.pickle.tempfile.NamedTemporaryFile", side_effect=OSError("tempfile failed")), patch(
755-
"cachier.cores.pickle.os.replace"
756-
) as mock_replace, patch("cachier.cores.pickle.os.remove") as mock_remove, pytest.raises(
757-
OSError, match="tempfile failed"
753+
with (
754+
patch("cachier.cores.pickle.tempfile.NamedTemporaryFile", side_effect=OSError("tempfile failed")),
755+
patch("cachier.cores.pickle.os.replace") as mock_replace,
756+
patch("cachier.cores.pickle.os.remove") as mock_remove,
757+
pytest.raises(OSError, match="tempfile failed"),
758758
):
759-
core._save_cache(
760-
{"key": CacheEntry(value="value", time=datetime.now(), stale=False, _processing=False)}
761-
)
759+
core._save_cache({"key": CacheEntry(value="value", time=datetime.now(), stale=False, _processing=False)})
762760

763761
mock_replace.assert_not_called()
764762
mock_remove.assert_not_called()
@@ -791,8 +789,9 @@ def mock_makedirs(path, exist_ok=False):
791789
raise PermissionError("temp dir not writable")
792790
raise AssertionError(f"Unexpected os.makedirs path: {path}")
793791

794-
with patch("cachier.cores.pickle.tempfile.gettempdir", return_value="/non-writable-temp"), patch(
795-
"cachier.cores.pickle.os.makedirs", side_effect=mock_makedirs
792+
with (
793+
patch("cachier.cores.pickle.tempfile.gettempdir", return_value="/non-writable-temp"),
794+
patch("cachier.cores.pickle.os.makedirs", side_effect=mock_makedirs),
796795
):
797796
assert core._shared_lock_fpath == os.path.join(
798797
fallback_lock_dir,
@@ -827,8 +826,9 @@ def mock_makedirs(path, exist_ok=False):
827826
raise PermissionError("lock dir not writable")
828827
raise AssertionError(f"Unexpected os.makedirs path: {path}")
829828

830-
with patch("cachier.cores.pickle.tempfile.gettempdir", return_value="/non-writable-temp"), patch(
831-
"cachier.cores.pickle.os.makedirs", side_effect=mock_makedirs
829+
with (
830+
patch("cachier.cores.pickle.tempfile.gettempdir", return_value="/non-writable-temp"),
831+
patch("cachier.cores.pickle.os.makedirs", side_effect=mock_makedirs),
832832
):
833833
assert core._shared_lock_fpath == os.path.join(core.cache_dir, f".{cache_hash}{core._SHARED_LOCK_SUFFIX}")
834834

0 commit comments

Comments
 (0)