This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_file2k.py depends on sys.stdin being unseekable
Type: Stage:
Components: Installation Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: python-dev, vstinner, xnox
Priority: normal Keywords: patch

Created on 2015-01-05 12:18 by xnox, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue23168.patch xnox, 2015-01-05 12:21
Messages (5)
msg233459 - (view) Author: Dimitri John Ledkov (xnox) * Date: 2015-01-05 12:18
# LD_LIBRARY_PATH=`pwd` ./python Lib/test/regrtest.py test_file2k </dev/null
[1/1] test_file2k
test test_file2k failed -- Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-2.7.9/Lib/test/test_file2k.py", line 236, in testStdin
    self.assertRaises(IOError, sys.stdin.seek, -1)
AssertionError: IOError not raised

1 test failed:
    test_file2k


I believe this is similar issue to http://bugs.python.org/issue14853
msg233460 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-01-05 13:01
Removing a test when it doesn't pass is not the correct way to fix a test...

I would be better to write it differently to support seekable stdin. Or if it doesn't make sense, skip the test if stdin is seeable.
msg233461 - (view) Author: Dimitri John Ledkov (xnox) * Date: 2015-01-05 13:03
> Removing a test when it doesn't pass is not the correct way to fix a test...

Whilst I agree, this is not what was done in http://bugs.python.org/issue14853 . There it was concluded that the test itself is bogus and tests essentially nothing.
msg233525 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-01-06 11:40
New changeset 7f30206d402f by Victor Stinner in branch '2.7':
Issue #23168: skip sys.stdin.seek() test if stdin is not a TTY
https://hg.python.org/cpython/rev/7f30206d402f
msg233526 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-01-06 11:40
Instead of removing the test, I modified it to be skipped if stdin is not a TTY.
History
Date User Action Args
2022-04-11 14:58:11adminsetgithub: 67357
2015-01-06 11:40:31vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg233526
2015-01-06 11:40:02python-devsetnosy: + python-dev
messages: + msg233525
2015-01-05 13:03:59xnoxsetmessages: + msg233461
2015-01-05 13:01:30vstinnersetnosy: + vstinner
messages: + msg233460
2015-01-05 12:21:47xnoxsetfiles: + issue23168.patch
keywords: + patch
2015-01-05 12:21:02xnoxsetcomponents: + Installation
versions: + Python 2.7
2015-01-05 12:18:38xnoxcreate