mirror of
https://github.com/python/cpython.git
synced 2025-08-19 08:11:46 +00:00
Backport r65900: fixed get_file_system in test_os.py ('path' is unicode on py3k and ansi on trunk)
This commit is contained in:
parent
4df1b6d478
commit
534c6e6e62
1 changed files with 8 additions and 5 deletions
|
@ -265,12 +265,15 @@ class StatAttributeTests(unittest.TestCase):
|
||||||
# systems support centiseconds
|
# systems support centiseconds
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
def get_file_system(path):
|
def get_file_system(path):
|
||||||
import os
|
root = os.path.splitdrive(os.path.abspath(path))[0] + '\\'
|
||||||
root = os.path.splitdrive(os.path.realpath("."))[0] + '\\'
|
|
||||||
import ctypes
|
import ctypes
|
||||||
kernel32 = ctypes.windll.kernel32
|
from ctypes.wintypes import LPCWSTR, LPWSTR, DWORD
|
||||||
buf = ctypes.create_string_buffer("", 100)
|
LPDWORD = ctypes.POINTER(DWORD)
|
||||||
if kernel32.GetVolumeInformationA(root, None, 0, None, None, None, buf, len(buf)):
|
f = ctypes.windll.kernel32.GetVolumeInformationW
|
||||||
|
f.argtypes = (LPCWSTR, LPWSTR, DWORD,
|
||||||
|
LPDWORD, LPDWORD, LPDWORD, LPWSTR, DWORD)
|
||||||
|
buf = ctypes.create_unicode_buffer("", 100)
|
||||||
|
if f(root, None, 0, None, None, None, buf, len(buf)):
|
||||||
return buf.value
|
return buf.value
|
||||||
|
|
||||||
if get_file_system(test_support.TESTFN) == "NTFS":
|
if get_file_system(test_support.TESTFN) == "NTFS":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue