Ignore:
Timestamp:
Dec 28, 2012, 11:03:01 AM (7 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Don't raise `PermanentError` for `host.path.isdir("/dir/subdir")`
if even the directory doesn't exist.

The fix was rather simple, but now ftputil does a lot more behind the
scenes; it traverses up from the path given as argument and does
a stat call on each of these traversals.

This means that in `mock_ftplib.MockSession`, we can no longer have
mixed directory strings for Unix and MS format, so some refactoring of
`MockSession` and changing of some dependent tests was necessary.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/mock_ftplib.py

    r1136 r1139  
    9393-rw-r--r--   1 45854    200          4605 Jan 19  2020 newer
    9494lrwxrwxrwx   1 45854    200            21 Jan 19  2002 link -> sschwarzer/index.html
    95 lrwxrwxrwx   1 45854    200            15 Jan 19  2002 bad_link -> python/bad_link""",
     95lrwxrwxrwx   1 45854    200            15 Jan 19  2002 bad_link -> python/bad_link
     96drwxr-sr-x   2 45854    200           512 May  4  2000 dir with spaces""",
    9697
    9798      '/home/python': """\
     
    118119      # relevant).
    119120      'sschwarzer': "",
    120 
    121       '/home/msformat': """\
    122 10-23-01  03:25PM       <DIR>          WindowsXP
    123 12-07-01  02:05PM       <DIR>          XPLaunch
    124 07-17-00  02:08PM             12266720 abcd.exe
    125 07-17-00  02:08PM                89264 O2KKeys.exe""",
    126 
    127       '/home/msformat/XPLaunch': """\
    128 10-23-01  03:25PM       <DIR>          WindowsXP
    129 12-07-01  02:05PM       <DIR>          XPLaunch
    130 12-07-01  02:05PM       <DIR>          empty
    131 07-17-00  02:08PM             12266720 abcd.exe
    132 07-17-00  02:08PM                89264 O2KKeys.exe""",
    133 
    134       '/home/msformat/XPLaunch/empty': "total 0",
    135121    }
    136122
     
    225211            assert self._transfercmds == 0
    226212
     213
     214class MockMSFormatSession(MockSession):
     215
     216    dir_contents = {
     217      '/': """\
     21810-23-01  03:25PM       <DIR>          home""",
     219
     220      '/home': """\
     22110-23-01  03:25PM       <DIR>          msformat""",
     222
     223      '/home/msformat': """\
     22410-23-01  03:25PM       <DIR>          WindowsXP
     22512-07-01  02:05PM       <DIR>          XPLaunch
     22607-17-00  02:08PM             12266720 abcd.exe
     22707-17-00  02:08PM                89264 O2KKeys.exe""",
     228
     229      '/home/msformat/XPLaunch': """\
     23010-23-01  03:25PM       <DIR>          WindowsXP
     23112-07-01  02:05PM       <DIR>          XPLaunch
     23212-07-01  02:05PM       <DIR>          empty
     23307-17-00  02:08PM             12266720 abcd.exe
     23407-17-00  02:08PM                89264 O2KKeys.exe""",
     235
     236      '/home/msformat/XPLaunch/empty': "total 0",
     237    }
Note: See TracChangeset for help on using the changeset viewer.