[Distutils] [issue137] test_get_script_header_jython_workaround expects output on stdout, but it is on stderr instead
Zooko O'Whielacronx
setuptools at bugs.python.org
Fri Nov 25 19:19:33 CET 2011
New submission from Zooko O'Whielacronx <zooko at zooko.com>:
This unit test fails on CPython 2.7.1 and pypy 1.7:
FAIL: test_get_script_header_jython_workaround (setuptools.tests.test_resources.ScriptHeaderTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/zooko/playground/setuptools/setuptools/tests/test_resources.py", line 524, in test_get_script_header_jython_workaround
self.assert_('Unable to adapt shebang line' in sys.stdout.getvalue())
AssertionError: False is not true
The following patch makes it pass on those two pythons:
Index: setuptools/tests/test_resources.py
===================================================================
--- setuptools/tests/test_resources.py (revision 88925)
+++ setuptools/tests/test_resources.py (working copy)
@@ -507,7 +507,7 @@
def test_get_script_header_jython_workaround(self):
platform = sys.platform
sys.platform = 'java1.5.0_13'
- stdout = sys.stdout
+ stderr = sys.stderr
try:
# A mock sys.executable that uses a shebang line (this file)
exe = os.path.normpath(os.path.splitext(__file__)[0] + '.py')
@@ -517,17 +517,17 @@
# Ensure we generate what is basically a broken shebang line
# when there's options, with a warning emitted
- sys.stdout = StringIO.StringIO()
+ sys.stderr = StringIO.StringIO()
self.assertEqual(get_script_header('#!/usr/bin/python -x',
executable=exe),
'#!%s -x\n' % exe)
- self.assert_('Unable to adapt shebang line' in sys.stdout.getvalue())
- sys.stdout = StringIO.StringIO()
+ self.assert_('Unable to adapt shebang line' in sys.stderr.getvalue())
+ sys.stderr = StringIO.StringIO()
self.assertEqual(get_script_header('#!/usr/bin/python',
executable=self.non_ascii_exe),
'#!%s -x\n' % self.non_ascii_exe)
- self.assert_('Unable to adapt shebang line' in sys.stdout.getvalue())
+ self.assert_('Unable to adapt shebang line' in sys.stderr.getvalue())
finally:
sys.platform = platform
- sys.stdout = stdout
+ sys.stderr = stderr
----------
messages: 653
nosy: zooko
priority: bug
status: unread
title: test_get_script_header_jython_workaround expects output on stdout, but it is on stderr instead
_______________________________________________
Setuptools tracker <setuptools at bugs.python.org>
<http://bugs.python.org/setuptools/issue137>
_______________________________________________
More information about the Distutils-SIG
mailing list