]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Clean up test_shutil, to facilitate upcoming improvements (#12721).
authorÉric Araujo <merwok@netwok.org>
Fri, 12 Aug 2011 17:51:35 +0000 (19:51 +0200)
committerÉric Araujo <merwok@netwok.org>
Fri, 12 Aug 2011 17:51:35 +0000 (19:51 +0200)
commita7e33a10aebf0296535ecc705191e7ce0009d591
treeb3ee7bcc2f4cf651e40988d8ed0d18ac27203b37
parentf04488e2baea6bd539e90765eee98a0151e90574
Clean up test_shutil, to facilitate upcoming improvements (#12721).

The tests now have two convenience functions to wrap os.path.join, open
and read or write instead of four or six slightly different functions.
The new functions accept a tuple of path segments but not a list
anymore, as it makes no sense to use a list here; I have also removed
the default value for the contents in write_file, as I find it better to
have the contents at the call site.

For simple open then read/write calls, I have left the usual idiom (with
open + read/write), as it is short and readable enough.

I’ve also changed some convoluted cleanup code to just use rmtree, and
removed dubious LBYL os.path.exists checks.  The tests still pass on my
machine, and leave no file in $TMP.  test_shutil is not as clean as it
could be, but I’ll stop here.

Initial patch provided by Hynek Schlawack, in preparation for a new
feature with new tests in #12715.
Lib/test/test_shutil.py