(self)
| 844 | |
| 845 | @unittest.skipUnless(sys.platform == "win32", "Win32 specific tests") |
| 846 | def test_access_denied(self): |
| 847 | # Default to FindFirstFile WIN32_FIND_DATA when access is |
| 848 | # denied. See issue 28075. |
| 849 | # os.environ['TEMP'] should be located on a volume that |
| 850 | # supports file ACLs. |
| 851 | fname = os.path.join(os.environ['TEMP'], self.fname + "_access") |
| 852 | self.addCleanup(os_helper.unlink, fname) |
| 853 | create_file(fname, b'ABC') |
| 854 | # Deny the right to [S]YNCHRONIZE on the file to |
| 855 | # force CreateFile to fail with ERROR_ACCESS_DENIED. |
| 856 | DETACHED_PROCESS = 8 |
| 857 | subprocess.check_call( |
| 858 | # bpo-30584: Use security identifier *S-1-5-32-545 instead |
| 859 | # of localized "Users" to not depend on the locale. |
| 860 | ['icacls.exe', fname, '/deny', '*S-1-5-32-545:(S)'], |
| 861 | creationflags=DETACHED_PROCESS |
| 862 | ) |
| 863 | result = os.stat(fname) |
| 864 | self.assertNotEqual(result.st_size, 0) |
| 865 | self.assertTrue(os.path.isfile(fname)) |
| 866 | |
| 867 | @unittest.skipUnless(sys.platform == "win32", "Win32 specific tests") |
| 868 | def test_stat_block_device(self): |
nothing calls this directly
no test coverage detected