mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-24 19:30:38 +00:00
test_s3: fix FakeFile.seek(): handles whence param
beforehand we didn't accept the seek() whence param, which failed with boto 2.4.0. Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
This commit is contained in:
parent
ebbafdb3e8
commit
adabd0ba7d
1 changed files with 8 additions and 2 deletions
|
@ -12,6 +12,7 @@ import random
|
||||||
import string
|
import string
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
|
import os
|
||||||
|
|
||||||
from httplib import HTTPConnection, HTTPSConnection
|
from httplib import HTTPConnection, HTTPSConnection
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
@ -2938,8 +2939,13 @@ class FakeFile(object):
|
||||||
self.char = char
|
self.char = char
|
||||||
self.interrupt = interrupt
|
self.interrupt = interrupt
|
||||||
|
|
||||||
def seek(self, offset):
|
def seek(self, offset, whence=os.SEEK_SET):
|
||||||
self.offset = offset
|
if whence == os.SEEK_SET:
|
||||||
|
self.offset = offset
|
||||||
|
elif whence == os.SEEK_END:
|
||||||
|
self.offset = self.size + offset;
|
||||||
|
elif whence == os.SEEK_CUR:
|
||||||
|
self.offset += offset
|
||||||
|
|
||||||
def tell(self):
|
def tell(self):
|
||||||
return self.offset
|
return self.offset
|
||||||
|
|
Loading…
Reference in a new issue