diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-09-17 12:51:14 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-09-17 12:51:14 (GMT) |
commit | 052e4f18c4d1794952b03755ff80aa92b8d19180 (patch) | |
tree | f334d0efb6bd66f415c1f44da3d85efb875d54b7 /Lib | |
parent | d508d00919dccbc9dd5d3c86508f2db7a7c753a7 (diff) | |
parent | 0b4dc4846b603025ee8da4403e87cad7739ac8f7 (diff) | |
download | cpython-052e4f18c4d1794952b03755ff80aa92b8d19180.zip cpython-052e4f18c4d1794952b03755ff80aa92b8d19180.tar.gz cpython-052e4f18c4d1794952b03755ff80aa92b8d19180.tar.bz2 |
Issue #28075: Merge from 3.5
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_os.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index afeefcb..1746ca4 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -460,6 +460,25 @@ class StatAttributeTests(unittest.TestCase): result.st_file_attributes & stat.FILE_ATTRIBUTE_DIRECTORY, stat.FILE_ATTRIBUTE_DIRECTORY) + @unittest.skipUnless(sys.platform == "win32", "Win32 specific tests") + def test_access_denied(self): + # Default to FindFirstFile WIN32_FIND_DATA when access is + # denied. See issue 28075. + # os.environ['TEMP'] should be located on a volume that + # supports file ACLs. + fname = os.path.join(os.environ['TEMP'], self.fname) + self.addCleanup(support.unlink, fname) + create_file(fname, b'ABC') + # Deny the right to [S]YNCHRONIZE on the file to + # force CreateFile to fail with ERROR_ACCESS_DENIED. + DETACHED_PROCESS = 8 + subprocess.check_call( + ['icacls.exe', fname, '/deny', 'Users:(S)'], + creationflags=DETACHED_PROCESS + ) + result = os.stat(fname) + self.assertNotEqual(result.st_size, 0) + class UtimeTests(unittest.TestCase): def setUp(self): |