[Python-Dev] [Python-checkins] cpython (3.2): test_os: add TemporaryFileTests to the testcase list (original) (raw)

Victor Stinner victor.stinner at haypocalc.com
Fri Jul 1 15:34:55 CEST 2011


Le vendredi 01 juillet 2011 ร  14:55 +0200, Ross Lagerwall a รฉcrit :

On Fri, 2011-07-01 at 11:18 +0200, Victor Stinner wrote: > I tried to find which commit removes TemporaryFileTests from the > testcase list (to see if there is a good reason to do that, or if it's > just a mistake): it's somewhere between Python 2.x and Python 3.0, but I > didn't find the commit.

For what it's worth, $ hg grep --all TemporaryFileTests Lib/test/testos.py Lib/test/testos.py:45773:+:class TemporaryFileTests(unittest.TestCase): Lib/test/testos.py:43680:-:class TemporaryFileTests(unittest.TestCase): Lib/test/testos.py:43680:-: TemporaryFileTests,

will show where TemporaryFileTests was removed and added.

It was added in the middle of an horrible trunk->3.x merge: "Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305, svn+ssh://pythondev@svn.python.org/python/trunk"

To find which commit removed a function in a file, hg bisect can be used (trick given on #mercurial):

PREVREV=$(hg id); hg bisect -r; hg bisect -g 0; hg bisect -c 'grep -q tmpnam Modules/posixmodule.c'; hg update $PREVREV

Even if it searchs in ~70.000 commits, it takes less than a second to find the commit which removed tmpnam in Python 3:

changeset: 43680:a8818ffe24d1 parent: 43673:d66018ed3ded user: Guido van Rossum <guido at python.org> date: Thu Oct 25 23๐Ÿ”ž51 2007 +0000 files: Doc/library/os.rst Lib/test/test_os.py Lib/test/test_posix.py Misc/NEWS Modules/posixmodule.c description: Patch 1318 by Christian Heimes: remove os.tmpnam(), os.tempnam(), and os.tmpfile().

Note: I did a new commit on test_os in Python 3.3 to remove TemporaryFileTests (again): most tests were useless because os.tmpnam(), os.tempnam() and os.tmpfile() don't exist anymore in Python 3.3. I moved remaining useful tests to another testcase.

Victor



More information about the Python-Dev mailing list