Skip to content

Commit

Permalink
py2 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
narrieta committed Apr 20, 2022
1 parent 803397e commit e17f9ac
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/utils/test_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ def test_archive_should_zip_all_but_the_latest_goal_state_in_the_history_folder(
test_directories.append(directory)

test_subject = StateArchiver(self.tmp_dir)
test_subject.archive()
# NOTE: StateArchiver sorts the state directories by creation time, but the test files are created too fast and the
# time resolution is too coarse, so instead we mock getctime to simply return the path of the file
with patch("azurelinuxagent.common.utils.archive.os.path.getctime", side_effect=lambda path: path):
test_subject.archive()

for directory in test_directories[0:2]:
zip_file = directory + ".zip"
Expand Down Expand Up @@ -111,7 +114,7 @@ def test_archive02(self):

test_subject = StateArchiver(self.tmp_dir)
# NOTE: StateArchiver sorts the state directories by creation time, but the test files are created too fast and the
# time resolution is too coarse so instead we mock getctime to simply return the path of the file
# time resolution is too coarse, so instead we mock getctime to simply return the path of the file
with patch("azurelinuxagent.common.utils.archive.os.path.getctime", side_effect=lambda path: path):
test_subject.purge()

Expand Down

0 comments on commit e17f9ac

Please sign in to comment.