Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6ef726af
Commit
6ef726af
authored
Apr 22, 2019
by
Berker Peksag
Committed by
GitHub
Apr 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-29734: Cleanup test_getfinalpathname_handles test (GH-12908)
parent
d59b662e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
21 deletions
+14
-21
Lib/test/test_os.py
Lib/test/test_os.py
+14
-21
No files found.
Lib/test/test_os.py
View file @
6ef726af
...
...
@@ -2337,19 +2337,10 @@ class Win32JunctionTests(unittest.TestCase):
@
unittest
.
skipUnless
(
sys
.
platform
==
"win32"
,
"Win32 specific tests"
)
class
Win32NtTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
from
test
import
support
self
.
nt
=
support
.
import_module
(
'nt'
)
pass
def
tearDown
(
self
):
pass
def
test_getfinalpathname_handles
(
self
):
try
:
import
ctypes
,
ctypes
.
wintypes
except
ImportError
:
raise
unittest
.
SkipTest
(
'ctypes module is required for this test'
)
nt
=
support
.
import_module
(
'nt'
)
ctypes
=
support
.
import_module
(
'ctypes'
)
import
ctypes.wintypes
kernel
=
ctypes
.
WinDLL
(
'Kernel32.dll'
,
use_last_error
=
True
)
kernel
.
GetCurrentProcess
.
restype
=
ctypes
.
wintypes
.
HANDLE
...
...
@@ -2368,21 +2359,23 @@ class Win32NtTests(unittest.TestCase):
before_count
=
handle_count
.
value
# The first two test the error path, __file__ tests the success path
filenames
=
[
r'\\?\
C:
',
filenames
=
[
r'\\?\
C:
',
r'
\\
?
\
NUL
',
r'
\\
?
\
CONIN
',
__file__ ]
__file__,
]
for
i
in range(10):
for
_
in range(10):
for name in filenames:
try:
tmp = self.
nt._getfinalpathname(name)
except:
nt._getfinalpathname(name)
except
Exception
:
# Failure is expected
pass
try:
tmp =
os.stat(name)
except:
os.stat(name)
except
Exception
:
pass
ok = kernel.GetProcessHandleCount(hproc, ctypes.byref(handle_count))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment