Skip to content

Commit

Permalink
Change form of metadata cache file timestamp in ReSDK tables
Browse files Browse the repository at this point in the history
  • Loading branch information
JureZmrzlikar committed Jul 11, 2024
1 parent 4c803ff commit bb1e76b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/resdk/tables/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ def _metadata_version(self) -> str:
version = (
newest_modified.astimezone(pytz.utc).isoformat().replace("+00:00", "Z")
)
# On Windows, datetime stamps are not appropriate as a part of file name.
# The reason is the colon char (":")
version = str(hash(version))
return version

@property
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def test_metadata_version(self):

ct = RNATables(self.collection)
version = ct._metadata_version
self.assertEqual(version, "2020-11-01T12:15:00Z")
self.assertEqual(version, str(hash("2020-11-01T12:15:00Z")))

# use cache
t = time()
Expand Down Expand Up @@ -315,7 +315,7 @@ def test_load_fetch(self, data_mock, meta_mock, save_mock, load_mock):
self.assertIs(data, self.metadata_df)
save_mock.assert_called_with(
self.metadata_df,
"/tmp/resdk/slug_meta_None_None_2020-11-01T12:15:00Z.pickle",
f"/tmp/resdk/slug_meta_None_None_{str(hash('2020-11-01T12:15:00Z'))}.pickle",
)

save_mock.reset_mock()
Expand Down

0 comments on commit bb1e76b

Please sign in to comment.