Commit b0300ad4 by rfkelly0

more comprehensive pickleability unit test

parent aa118ef1
...@@ -584,9 +584,9 @@ class FS(object): ...@@ -584,9 +584,9 @@ class FS(object):
except OSError: except OSError:
pass pass
def movefile_noerrors(src, dst, overwrite): def movefile_noerrors(src, dst, overwrite, chunk_size):
try: try:
return self.move(src, dst, overwrite) return self.move(src, dst, overwrite, chunk_size)
except FSError: except FSError:
return return
if ignore_errors: if ignore_errors:
......
...@@ -410,7 +410,6 @@ class MountProcess(subprocess.Popen): ...@@ -410,7 +410,6 @@ class MountProcess(subprocess.Popen):
if nowait or kwds.get("close_fds",False): if nowait or kwds.get("close_fds",False):
cmd = 'from fs.expose.fuse import MountProcess; ' cmd = 'from fs.expose.fuse import MountProcess; '
cmd = cmd + 'MountProcess._do_mount_nowait(%s)' cmd = cmd + 'MountProcess._do_mount_nowait(%s)'
cmd = cmd % (pickle.dumps((fs,path,fuse_opts)),)
cmd = cmd % (repr(pickle.dumps((fs,path,fuse_opts),-1)),) cmd = cmd % (repr(pickle.dumps((fs,path,fuse_opts),-1)),)
cmd = [sys.executable,"-c",cmd] cmd = [sys.executable,"-c",cmd]
super(MountProcess,self).__init__(cmd,**kwds) super(MountProcess,self).__init__(cmd,**kwds)
...@@ -430,6 +429,7 @@ class MountProcess(subprocess.Popen): ...@@ -430,6 +429,7 @@ class MountProcess(subprocess.Popen):
self.terminate() self.terminate()
def killme(): def killme():
self.kill() self.kill()
time.sleep(0.1)
try: try:
unmount(self.path) unmount(self.path)
except OSError: except OSError:
......
...@@ -33,7 +33,8 @@ class OSFS(FS): ...@@ -33,7 +33,8 @@ class OSFS(FS):
return "<OSFS: %s>" % self.root_path return "<OSFS: %s>" % self.root_path
def getsyspath(self, path, allow_none=False): def getsyspath(self, path, allow_none=False):
sys_path = os.path.join(self.root_path, relpath(path)).replace('/', os.sep) path = relpath(path).replace('/', os.sep)
sys_path = os.path.join(self.root_path, path)
return sys_path return sys_path
@convert_os_errors @convert_os_errors
......
...@@ -258,6 +258,7 @@ class FSTestCases: ...@@ -258,6 +258,7 @@ class FSTestCases:
self.fs.movedir("a", "copy of a") self.fs.movedir("a", "copy of a")
self.assert_(self.fs.isdir("copy of a"))
self.assert_(check("copy of a/1.txt")) self.assert_(check("copy of a/1.txt"))
self.assert_(check("copy of a/2.txt")) self.assert_(check("copy of a/2.txt"))
self.assert_(check("copy of a/3.txt")) self.assert_(check("copy of a/3.txt"))
...@@ -456,6 +457,8 @@ class FSTestCases: ...@@ -456,6 +457,8 @@ class FSTestCases:
self.fs.createfile("test1","hello world") self.fs.createfile("test1","hello world")
fs2 = pickle.loads(pickle.dumps(self.fs)) fs2 = pickle.loads(pickle.dumps(self.fs))
self.assert_(fs2.isfile("test1")) self.assert_(fs2.isfile("test1"))
fs3 = pickle.loads(pickle.dumps(self.fs,-1))
self.assert_(fs3.isfile("test1"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment