[docs] [issue16278] os.rename documentation slightly inaccurate

Todd Rovito report at bugs.python.org
Mon Nov 5 05:09:33 CET 2012

Todd Rovito added the comment:

Attached is a patch for 16 test cases.  All 16 test cases have been tested on Windows 7, Mac OS X, and Linux they seem to function well.  Before this patch there was only a single test case for rename.  For each test case I used "unittest.skipUnless" to make sure the platform was one of the three that I tested for Windows 7, Mac OS X, or Linux.  These test cases demonstrate that the documentation is incorrect and perhaps a little fuzzy.  I plan to submit updates to the documentation in the coming days.  This patch is only for Python 3.4 but I will backport to 2.7 in a few days.  

I wrote the following code to find all the combinations based on parameters of the function:

src = ['src_file','src_directory_empty', 'src_directory_not_empty', \
dst = ['dst_file_exist','dst_not_exist','dst_directory_empty', \

print "Make sure you have functions in test_os for all of these"
for index_src in range(0, len(src)):
    for index_dst in range(0, len(dst)):
        function_name = "test_rename_" + src[index_src] + "_" + \
        print function_name

versions:  -Python 2.7, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file27890/OSRename_test_os_3point4.patch

Python tracker <report at bugs.python.org>

More information about the docs mailing list