mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Re-flow several long lines from #1578269.
This commit is contained in:
parent
c739569be0
commit
74e4561a3c
6 changed files with 41 additions and 22 deletions
|
|
@ -12,7 +12,8 @@ from ctypes import wintypes
|
|||
GetCurrentProcess = ctypes.windll.kernel32.GetCurrentProcess
|
||||
GetCurrentProcess.restype = wintypes.HANDLE
|
||||
OpenProcessToken = ctypes.windll.advapi32.OpenProcessToken
|
||||
OpenProcessToken.argtypes = (wintypes.HANDLE, wintypes.DWORD, ctypes.POINTER(wintypes.HANDLE))
|
||||
OpenProcessToken.argtypes = (wintypes.HANDLE, wintypes.DWORD,
|
||||
ctypes.POINTER(wintypes.HANDLE))
|
||||
OpenProcessToken.restype = wintypes.BOOL
|
||||
|
||||
class LUID(ctypes.Structure):
|
||||
|
|
@ -91,7 +92,8 @@ class TOKEN_PRIVILEGES(ctypes.Structure):
|
|||
|
||||
def get_array(self):
|
||||
array_type = LUID_AND_ATTRIBUTES*self.count
|
||||
privileges = ctypes.cast(self.privileges, ctypes.POINTER(array_type)).contents
|
||||
privileges = ctypes.cast(self.privileges,
|
||||
ctypes.POINTER(array_type)).contents
|
||||
return privileges
|
||||
|
||||
def __iter__(self):
|
||||
|
|
@ -133,7 +135,8 @@ def get_process_token():
|
|||
def get_symlink_luid():
|
||||
"Get the LUID for the SeCreateSymbolicLinkPrivilege"
|
||||
symlink_luid = LUID()
|
||||
res = LookupPrivilegeValue(None, "SeCreateSymbolicLinkPrivilege", symlink_luid)
|
||||
res = LookupPrivilegeValue(None, "SeCreateSymbolicLinkPrivilege",
|
||||
symlink_luid)
|
||||
if not res > 0:
|
||||
raise RuntimeError("Couldn't lookup privilege value")
|
||||
return symlink_luid
|
||||
|
|
|
|||
|
|
@ -1034,7 +1034,8 @@ class Win32KillTests(unittest.TestCase):
|
|||
|
||||
|
||||
def skipUnlessWindows6(test):
|
||||
if hasattr(sys, 'getwindowsversion') and sys.getwindowsversion().major >= 6:
|
||||
if (hasattr(sys, 'getwindowsversion')
|
||||
and sys.getwindowsversion().major >= 6):
|
||||
return test
|
||||
return unittest.skip("Requires Windows Vista or later")(test)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ class PlatformTest(unittest.TestCase):
|
|||
# On Windows, the EXE needs to know where pythonXY.dll is at so we have
|
||||
# to add the directory to the path.
|
||||
if sys.platform == "win32":
|
||||
os.environ["Path"] = "{};{}".format(os.path.dirname(sys.executable),
|
||||
os.environ["Path"])
|
||||
os.environ["Path"] = "{};{}".format(
|
||||
os.path.dirname(sys.executable), os.environ["Path"])
|
||||
|
||||
def get(python):
|
||||
cmd = [python, '-c',
|
||||
|
|
|
|||
|
|
@ -244,8 +244,8 @@ class TestSysConfig(unittest.TestCase):
|
|||
# On Windows, the EXE needs to know where pythonXY.dll is at so we have
|
||||
# to add the directory to the path.
|
||||
if sys.platform == "win32":
|
||||
os.environ["Path"] = "{};{}".format(os.path.dirname(sys.executable),
|
||||
os.environ["Path"])
|
||||
os.environ["Path"] = "{};{}".format(
|
||||
os.path.dirname(sys.executable), os.environ["Path"])
|
||||
|
||||
# Issue 7880
|
||||
def get(python):
|
||||
|
|
|
|||
|
|
@ -291,7 +291,8 @@ class MiscReadTest(CommonReadTest):
|
|||
self.assertTrue(self.tar.getmembers()[-1].name == "misc/eof",
|
||||
"could not find all members")
|
||||
|
||||
@unittest.skipUnless(hasattr(os, "link"), "Missing hardlink implementation")
|
||||
@unittest.skipUnless(hasattr(os, "link"),
|
||||
"Missing hardlink implementation")
|
||||
@support.skip_unless_symlink
|
||||
def test_extract_hardlink(self):
|
||||
# Test hardlink extraction (e.g. bug #857297).
|
||||
|
|
@ -1423,11 +1424,13 @@ class LinkEmulationTest(ReadTest):
|
|||
def test_hardlink_extraction2(self):
|
||||
self._test_link_extraction("./ustar/linktest2/lnktype")
|
||||
|
||||
@unittest.skipIf(hasattr(os, "symlink"), "Skip emulation if symlink exists")
|
||||
@unittest.skipIf(hasattr(os, "symlink"),
|
||||
"Skip emulation if symlink exists")
|
||||
def test_symlink_extraction1(self):
|
||||
self._test_link_extraction("ustar/symtype")
|
||||
|
||||
@unittest.skipIf(hasattr(os, "symlink"), "Skip emulation if symlink exists")
|
||||
@unittest.skipIf(hasattr(os, "symlink"),
|
||||
"Skip emulation if symlink exists")
|
||||
def test_symlink_extraction2(self):
|
||||
self._test_link_extraction("./ustar/linktest2/symtype")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue