Skip to content

Commit 1be2ab6

Browse files
committed
tmp_path
1 parent 6f3b230 commit 1be2ab6

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

tests/test_pickle_core.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -733,12 +733,12 @@ def test_convert_legacy_cache_entry_dict():
733733

734734

735735
@pytest.mark.pickle
736-
def test_save_cache_with_invalid_separate_file_key(temp_dir):
736+
def test_save_cache_with_invalid_separate_file_key(tmp_path):
737737
"""Test _save_cache raises error with invalid separate_file_key."""
738738
# Test line 179-181: ValueError when separate_file_key used with dict
739739
core = _PickleCore(
740740
hash_func=None,
741-
cache_dir=temp_dir,
741+
cache_dir=tmp_path,
742742
pickle_reload=False,
743743
wait_for_calc_timeout=10,
744744
separate_files=False,
@@ -759,12 +759,12 @@ def mock_func():
759759

760760

761761
@pytest.mark.pickle
762-
def test_set_entry_should_not_store(temp_dir):
762+
def test_set_entry_should_not_store(tmp_path):
763763
"""Test set_entry when value should not be stored."""
764764
# Test line 204: early return when _should_store returns False
765765
core = _PickleCore(
766766
hash_func=None,
767-
cache_dir=temp_dir,
767+
cache_dir=tmp_path,
768768
pickle_reload=False,
769769
wait_for_calc_timeout=10,
770770
separate_files=False,
@@ -784,12 +784,12 @@ def mock_func():
784784

785785

786786
@pytest.mark.pickle
787-
def test_mark_entry_not_calculated_separate_files_no_entry(temp_dir):
787+
def test_mark_entry_not_calculated_separate_files_no_entry(tmp_path):
788788
"""Test _mark_entry_not_calculated_separate_files with no entry."""
789789
# Test line 236: early return when entry is None
790790
core = _PickleCore(
791791
hash_func=None,
792-
cache_dir=temp_dir,
792+
cache_dir=tmp_path,
793793
pickle_reload=False,
794794
wait_for_calc_timeout=10,
795795
separate_files=True,
@@ -837,12 +837,12 @@ def test_cleanup_observer_exception():
837837

838838

839839
@pytest.mark.pickle
840-
def test_wait_on_entry_calc_inotify_limit(temp_dir):
840+
def test_wait_on_entry_calc_inotify_limit(tmp_path):
841841
"""Test wait_on_entry_calc fallback when inotify limit is reached."""
842842
# Test lines 298-302: OSError handling for inotify limit
843843
core = _PickleCore(
844844
hash_func=None,
845-
cache_dir=temp_dir,
845+
cache_dir=tmp_path,
846846
pickle_reload=False,
847847
wait_for_calc_timeout=10,
848848
separate_files=False,
@@ -878,12 +878,12 @@ def mock_wait_inotify(key, filename):
878878

879879

880880
@pytest.mark.pickle
881-
def test_wait_on_entry_calc_other_os_error(temp_dir):
881+
def test_wait_on_entry_calc_other_os_error(tmp_path):
882882
"""Test wait_on_entry_calc re-raises non-inotify OSErrors."""
883883
# Test line 302: re-raise other OSErrors
884884
core = _PickleCore(
885885
hash_func=None,
886-
cache_dir=temp_dir,
886+
cache_dir=tmp_path,
887887
pickle_reload=False,
888888
wait_for_calc_timeout=10,
889889
separate_files=False,
@@ -906,12 +906,12 @@ def mock_wait_inotify(key, filename):
906906

907907

908908
@pytest.mark.pickle
909-
def test_wait_with_polling_file_errors(temp_dir):
909+
def test_wait_with_polling_file_errors(tmp_path):
910910
"""Test _wait_with_polling handles file errors gracefully."""
911911
# Test lines 352-354: FileNotFoundError/EOFError handling
912912
core = _PickleCore(
913913
hash_func=None,
914-
cache_dir=temp_dir,
914+
cache_dir=tmp_path,
915915
pickle_reload=False,
916916
wait_for_calc_timeout=2, # Short timeout
917917
separate_files=False,
@@ -952,12 +952,12 @@ def mock_get_cache_dict():
952952

953953

954954
@pytest.mark.pickle
955-
def test_wait_with_polling_separate_files(temp_dir):
955+
def test_wait_with_polling_separate_files(tmp_path):
956956
"""Test _wait_with_polling with separate files mode."""
957957
# Test lines 342-343: separate files branch
958958
core = _PickleCore(
959959
hash_func=None,
960-
cache_dir=temp_dir,
960+
cache_dir=tmp_path,
961961
pickle_reload=False,
962962
wait_for_calc_timeout=10,
963963
separate_files=True,
@@ -984,12 +984,12 @@ def mock_func():
984984

985985

986986
@pytest.mark.pickle
987-
def test_delete_stale_entries_separate_files(temp_dir):
987+
def test_delete_stale_entries_separate_files(tmp_path):
988988
"""Test delete_stale_entries with separate files mode."""
989989
# Test lines 377-387: separate files deletion logic
990990
core = _PickleCore(
991991
hash_func=None,
992-
cache_dir=temp_dir,
992+
cache_dir=tmp_path,
993993
pickle_reload=False,
994994
wait_for_calc_timeout=10,
995995
separate_files=True,
@@ -1027,7 +1027,7 @@ def mock_func():
10271027
pickle.dump(fresh_entry, f)
10281028

10291029
# Create non-matching file (should be ignored)
1030-
other_file = os.path.join(temp_dir, "other_file.txt")
1030+
other_file = os.path.join(tmp_path, "other_file.txt")
10311031
with open(other_file, "w") as f:
10321032
f.write("other content")
10331033

@@ -1045,12 +1045,12 @@ def mock_func():
10451045

10461046

10471047
@pytest.mark.pickle
1048-
def test_delete_stale_entries_file_not_found(temp_dir):
1048+
def test_delete_stale_entries_file_not_found(tmp_path):
10491049
"""Test delete_stale_entries handles FileNotFoundError."""
10501050
# Test lines 385-386: FileNotFoundError suppression
10511051
core = _PickleCore(
10521052
hash_func=None,
1053-
cache_dir=temp_dir,
1053+
cache_dir=tmp_path,
10541054
pickle_reload=False,
10551055
wait_for_calc_timeout=10,
10561056
separate_files=True,

0 commit comments

Comments
 (0)