]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Enhance and modernize test_genericpath
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 24 Mar 2016 12:44:19 +0000 (13:44 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 24 Mar 2016 12:44:19 +0000 (13:44 +0100)
commite321274b2eeaf9cfaccbc8d40c4056ab72040e1b
treed0ebaed68026c1a73a22a219f2424f347de1121e
parentba8b0a7db447fad7a7064e53424725b02ab5ccec
Enhance and modernize test_genericpath

* Replace "try/finally: os.remove()" with self.addCleanup(support.unlink) or
  self.addCleanup(support.rmdir): the support function handles the case when
  the file doesn't exist
* Replace "try/finally: f.close()" with "with open(...) as f:"
* test_getsize: add a second test with a different size
* Create file using "x" mode to ensure that the file didn't exist before, to
  detect bugs in tests
* Open files in unbuffered mode (buferring=0) to write immediatly data on disk
* Replace map() with simpler code
* Split isdir() unit test into two units tests to make them less dependant,
  same change for isfile() test
* test_samefile(): test also two different files
Lib/test/test_genericpath.py