Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
a1ef38f9
Commit
a1ef38f9
authored
Jan 03, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use contexts.quiet for stdout/stderr trapping
parent
f3875aa7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
setuptools/tests/test_easy_install.py
setuptools/tests/test_easy_install.py
+5
-8
No files found.
setuptools/tests/test_easy_install.py
View file @
a1ef38f9
...
@@ -451,8 +451,7 @@ class TestScriptHeader:
...
@@ -451,8 +451,7 @@ class TestScriptHeader:
mock
.
Mock
(
getProperty
=
mock
.
Mock
(
return_value
=
""
)))))
mock
.
Mock
(
getProperty
=
mock
.
Mock
(
return_value
=
""
)))))
@
mock
.
patch
(
'sys.platform'
,
'java1.5.0_13'
)
@
mock
.
patch
(
'sys.platform'
,
'java1.5.0_13'
)
def
test_get_script_header_jython_workaround
(
self
):
def
test_get_script_header_jython_workaround
(
self
):
stdout
,
stderr
=
sys
.
stdout
,
sys
.
stderr
with
contexts
.
quiet
()
as
(
stdout
,
stderr
):
try
:
# A mock sys.executable that uses a shebang line (this file)
# A mock sys.executable that uses a shebang line (this file)
exe
=
os
.
path
.
normpath
(
os
.
path
.
splitext
(
__file__
)[
0
]
+
'.py'
)
exe
=
os
.
path
.
normpath
(
os
.
path
.
splitext
(
__file__
)[
0
]
+
'.py'
)
assert
(
assert
(
...
@@ -463,15 +462,13 @@ class TestScriptHeader:
...
@@ -463,15 +462,13 @@ class TestScriptHeader:
# Ensure we generate what is basically a broken shebang line
# Ensure we generate what is basically a broken shebang line
# when there's options, with a warning emitted
# when there's options, with a warning emitted
sys
.
stdout
=
sys
.
stderr
=
StringIO
()
candidate
=
get_script_header
(
'#!/usr/bin/python -x'
,
candidate
=
get_script_header
(
'#!/usr/bin/python -x'
,
executable
=
exe
)
executable
=
exe
)
assert
candidate
==
'#!%s -x
\
n
'
%
exe
assert
candidate
==
'#!%s -x
\
n
'
%
exe
assert
'Unable to adapt shebang line'
in
sys
.
stdout
.
getvalue
()
assert
'Unable to adapt shebang line'
in
stderr
.
getvalue
()
sys
.
stdout
=
sys
.
stderr
=
StringIO
()
with
contexts
.
quiet
()
as
(
stdout
,
stderr
):
candidate
=
get_script_header
(
'#!/usr/bin/python'
,
candidate
=
get_script_header
(
'#!/usr/bin/python'
,
executable
=
self
.
non_ascii_exe
)
executable
=
self
.
non_ascii_exe
)
assert
candidate
==
'#!%s -x
\
n
'
%
self
.
non_ascii_exe
assert
candidate
==
'#!%s -x
\
n
'
%
self
.
non_ascii_exe
assert
'Unable to adapt shebang line'
in
sys
.
stdout
.
getvalue
()
assert
'Unable to adapt shebang line'
in
stderr
.
getvalue
()
finally
:
sys
.
stdout
,
sys
.
stderr
=
stdout
,
stderr
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