Skip to content

Commit

Permalink
Different cache directories in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanFauble committed Nov 3, 2023
1 parent aecf808 commit 2996ffc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/unit/synapseclient/core/unit_test_Cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,11 +555,11 @@ def test_cache_item_unmodified_modified_items_is_modified_timestamp(self):

# AND a file created in my cache directory
file_path = utils.touch(
os.path.join(my_cache.get_cache_dir(101201), "file1.ext")
os.path.join(my_cache.get_cache_dir(131201), "file1.ext")
)

# AND the file is added to the cache
my_cache.add(file_handle_id=101201, path=file_path)
my_cache.add(file_handle_id=131201, path=file_path)

# WHEN we modify the file timestamp
new_time_stamp = cache._get_modified_time(file_path) + 1
Expand All @@ -568,7 +568,7 @@ def test_cache_item_unmodified_modified_items_is_modified_timestamp(self):
# THEN we expect the file to be modified
unmodified = my_cache._cache_item_unmodified(
cache_map_entry=my_cache._read_cache_map(
cache_dir=my_cache.get_cache_dir(101201)
cache_dir=my_cache.get_cache_dir(131201)
).get(file_path),
path=file_path,
)
Expand All @@ -580,12 +580,12 @@ def test_cache_item_unmodified_modified_items_is_modified_timestamp(self):
my_cache = cache.Cache(cache_root_dir=tmp_dir)

# AND a file created in my cache directory
file_path = os.path.join(my_cache.get_cache_dir(101201), "file1.ext")
file_path = os.path.join(my_cache.get_cache_dir(121201), "file1.ext")
utils.touch(file_path)
utils.make_bogus_binary_file(filepath=file_path)

# AND the file is added to the cache
my_cache.add(file_handle_id=101201, path=file_path)
my_cache.add(file_handle_id=121201, path=file_path)

# WHEN we replace the file with another of the same name
os.remove(file_path)
Expand All @@ -595,7 +595,7 @@ def test_cache_item_unmodified_modified_items_is_modified_timestamp(self):
# THEN we expect the file to be modified
unmodified = my_cache._cache_item_unmodified(
cache_map_entry=my_cache._read_cache_map(
cache_dir=my_cache.get_cache_dir(101201)
cache_dir=my_cache.get_cache_dir(121201)
).get(file_path),
path=file_path,
)
Expand All @@ -608,16 +608,16 @@ def test_cache_item_unmodified_not_modified(self):

# AND a file created in my cache directory
file_path = utils.touch(
os.path.join(my_cache.get_cache_dir(101201), "file1.ext")
os.path.join(my_cache.get_cache_dir(111201), "file1.ext")
)

# AND the file is added to the cache
my_cache.add(file_handle_id=101201, path=file_path)
my_cache.add(file_handle_id=111201, path=file_path)

# THEN we expect the file to be unmodified
unmodified = my_cache._cache_item_unmodified(
cache_map_entry=my_cache._read_cache_map(
cache_dir=my_cache.get_cache_dir(101201)
cache_dir=my_cache.get_cache_dir(111201)
).get(file_path),
path=file_path,
)
Expand Down

0 comments on commit 2996ffc

Please sign in to comment.