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
99bd57d7
Commit
99bd57d7
authored
Mar 17, 2015
by
Ned Deily
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #23458: Skip test_urandom_fd_non_inheritable on OS X 10.4 since
FD_CLOEXEC is not supported there.
parent
b0a53fca
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
Lib/test/test_os.py
Lib/test/test_os.py
+2
-0
Lib/test/test_support.py
Lib/test/test_support.py
+29
-1
No files found.
Lib/test/test_os.py
View file @
99bd57d7
...
...
@@ -571,6 +571,8 @@ class URandomTests (unittest.TestCase):
# os.urandom() doesn't use a file descriptor on Windows
@
unittest
.
skipIf
(
sys
.
platform
==
"win32"
,
"POSIX specific tests"
)
# FD_CLOEXEC is first supported on OS X 10.5
@
test_support
.
requires_mac_ver
(
10
,
5
)
def
test_urandom_fd_non_inheritable
(
self
):
# Issue #23458: os.urandom() keeps a file descriptor open, but it
# must be non inheritable
...
...
Lib/test/test_support.py
View file @
99bd57d7
...
...
@@ -28,7 +28,8 @@ except ImportError:
__all__
=
[
"Error"
,
"TestFailed"
,
"ResourceDenied"
,
"import_module"
,
"verbose"
,
"use_resources"
,
"max_memuse"
,
"record_original_stdout"
,
"get_original_stdout"
,
"unload"
,
"unlink"
,
"rmtree"
,
"forget"
,
"is_resource_enabled"
,
"requires"
,
"find_unused_port"
,
"bind_port"
,
"is_resource_enabled"
,
"requires"
,
"requires_mac_ver"
,
"find_unused_port"
,
"bind_port"
,
"fcmp"
,
"have_unicode"
,
"is_jython"
,
"TESTFN"
,
"HOST"
,
"FUZZ"
,
"SAVEDCWD"
,
"temp_cwd"
,
"findfile"
,
"sortdict"
,
"check_syntax_error"
,
"open_urlresource"
,
"check_warnings"
,
"check_py3k_warnings"
,
...
...
@@ -361,6 +362,33 @@ def requires(resource, msg=None):
msg
=
"Use of the `%s' resource not enabled"
%
resource
raise
ResourceDenied
(
msg
)
def
requires_mac_ver
(
*
min_version
):
"""Decorator raising SkipTest if the OS is Mac OS X and the OS X
version if less than min_version.
For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
is lesser than 10.5.
"""
def
decorator
(
func
):
@
functools
.
wraps
(
func
)
def
wrapper
(
*
args
,
**
kw
):
if
sys
.
platform
==
'darwin'
:
version_txt
=
platform
.
mac_ver
()[
0
]
try
:
version
=
tuple
(
map
(
int
,
version_txt
.
split
(
'.'
)))
except
ValueError
:
pass
else
:
if
version
<
min_version
:
min_version_txt
=
'.'
.
join
(
map
(
str
,
min_version
))
raise
unittest
.
SkipTest
(
"Mac OS X %s or higher required, not %s"
%
(
min_version_txt
,
version_txt
))
return
func
(
*
args
,
**
kw
)
wrapper
.
min_version
=
min_version
return
wrapper
return
decorator
# Don't use "localhost", since resolving it uses the DNS under recent
# Windows versions (see issue #18792).
...
...
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