aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gn3/file_utils.py2
-rw-r--r--tests/unit/test_file_utils.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/gn3/file_utils.py b/gn3/file_utils.py
index 79e6854..d6e1c66 100644
--- a/gn3/file_utils.py
+++ b/gn3/file_utils.py
@@ -13,7 +13,7 @@ def get_dir_hash(directory: str) -> str:
if not os.path.exists(directory):
raise FileNotFoundError
for root, _, files in os.walk(directory):
- for names in files:
+ for names in sorted(files):
file_path = os.path.join(root, names)
with open(file_path, "rb") as file_:
for buf in iter(partial(file_.read, 4096), b''):
diff --git a/tests/unit/test_file_utils.py b/tests/unit/test_file_utils.py
index a54680d..f5efa02 100644
--- a/tests/unit/test_file_utils.py
+++ b/tests/unit/test_file_utils.py
@@ -13,7 +13,7 @@ class TestFileUtils(unittest.TestCase):
def test_get_dir_hash(self):
"""Test that a directory is hashed correctly"""
test_dir = os.path.join(os.path.dirname(__file__), "test_data")
- self.assertEqual("928a0e2e4846b4b3c2881d9c1d6cfce4",
+ self.assertEqual("fd9d74a9554b7f13bfeffbdda8e61486",
get_dir_hash(test_dir))
def test_get_dir_hash_non_existent_dir(self):