https://github.com/python/cpython/commit/d91ddff5de61447844f1dac575d2e670c8d7e26b
commit: d91ddff5de61447844f1dac575d2e670c8d7e26b
branch: main
author: Steve Dower <[email protected]>
committer: zooba <[email protected]>
date: 2024-01-26T17:33:44Z
summary:

gh-114435: Allow test_stat_inaccessible_file() to have matching ino/dev 
(GH-114571)

This may occur if Windows allows reading stat information from a file even if 
the current user does not have access.

files:
M Lib/test/test_os.py

diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index ed1f304c6c8cac..e6f0dfde8cb4ae 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -3129,10 +3129,9 @@ def cleanup():
         if support.verbose:
             print(" without access:", stat2)
 
-        # We cannot get st_dev/st_ino, so ensure those are 0 or else our test
-        # is not set up correctly
-        self.assertEqual(0, stat2.st_dev)
-        self.assertEqual(0, stat2.st_ino)
+        # We may not get st_dev/st_ino, so ensure those are 0 or match
+        self.assertIn(stat2.st_dev, (0, stat1.st_dev))
+        self.assertIn(stat2.st_ino, (0, stat1.st_ino))
 
         # st_mode and st_size should match (for a normal file, at least)
         self.assertEqual(stat1.st_mode, stat2.st_mode)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to