Changeset 1620:525a118b3085


Ignore:
Timestamp:
Dec 23, 2015, 5:56:01 PM (5 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Explain lack of tests for reading/writing beyond the end of a file

Here's a copy of the comment because this may also be interesting as
part of the commit message:

  There are no tests for reading and writing beyond the end of a
  file. For example, if the remote file is 10 bytes long and
  `open(remote_file, "rb", rest=100)` is used, the server may
  return an error status code or not.

  The server I use for testing returns a 554 status when
  attempting to _read_ beyond the end of the file. On the other
  hand, if attempting to _write_ beyond the end of the file, the
  server accepts the request, but starts writing after the end of
  the file, i. e. appends to the file.

  Instead of expecting certain responses that may differ between
  server implementations, I leave the bahavior for too large
  `rest` arguments undefined. In practice, this shouldn't be a
  problem because the `rest` argument should only be used for
  error recovery, and in this case a valid byte count for the
  `rest` argument should be known.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/test_real_ftp.py

    r1619 r1620  
    819819            self.host.open(self.TEST_FILE_NAME, "w", rest=3)
    820820
     821    # There are no tests for reading and writing beyond the end of a
     822    # file. For example, if the remote file is 10 bytes long and
     823    # `open(remote_file, "rb", rest=100)` is used, the server may
     824    # return an error status code or not.
     825    #
     826    # The server I use for testing returns a 554 status when
     827    # attempting to _read_ beyond the end of the file. On the other
     828    # hand, if attempting to _write_ beyond the end of the file, the
     829    # server accepts the request, but starts writing after the end of
     830    # the file, i. e. appends to the file.
     831    #
     832    # Instead of expecting certain responses that may differ between
     833    # server implementations, I leave the bahavior for too large
     834    # `rest` arguments undefined. In practice, this shouldn't be a
     835    # problem because the `rest` argument should only be used for
     836    # error recovery, and in this case a valid byte count for the
     837    # `rest` argument should be known.
     838
    821839
    822840class TestOther(RealFTPTest):
Note: See TracChangeset for help on using the changeset viewer.