Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
c11e1f68
Commit
c11e1f68
authored
Jul 13, 2009
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
got latest unittests passing on Windows
parent
0173c6c7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
27 deletions
+40
-27
fs/errors.py
+4
-0
fs/expose/fuse/__init__.py
+4
-1
fs/tests/__init__.py
+1
-0
fs/tests/test_expose.py
+31
-26
No files found.
fs/errors.py
View file @
c11e1f68
...
...
@@ -180,6 +180,10 @@ def convert_os_errors(func):
raise
ResourceInvalidError
(
path
,
opname
=
opname
,
details
=
e
)
if
e
.
errno
==
errno
.
EINVAL
:
raise
ResourceInvalidError
(
path
,
opname
=
opname
,
details
=
e
)
# Sometimes windows gives some random errors...
if
sys
.
platform
==
"win32"
:
if
e
.
errno
in
(
13
,):
raise
ResourceInvalidError
(
path
,
opname
=
opname
,
details
=
e
)
raise
OperationFailedError
(
opname
,
details
=
e
)
return
wrapper
...
...
fs/expose/fuse/__init__.py
View file @
c11e1f68
...
...
@@ -56,7 +56,10 @@ from fs.base import flags_to_mode, threading
from
fs.errors
import
*
from
fs.path
import
*
import
fuse_ctypes
as
fuse
try
:
import
fuse_ctypes
as
fuse
except
NotImplementedError
:
raise
ImportError
(
"FUSE found but not usable"
)
try
:
fuse
.
_libfuse
.
fuse_get_context
except
AttributeError
:
...
...
fs/tests/__init__.py
View file @
c11e1f68
...
...
@@ -67,6 +67,7 @@ class FSTestCases:
self
.
check
(
"test1.txt"
)
f
=
self
.
fs
.
open
(
"test1.txt"
,
"r"
)
self
.
assertEquals
(
f
.
read
(),
"test file overwrite"
)
f
.
close
()
def
test_isdir_isfile
(
self
):
self
.
assertFalse
(
self
.
fs
.
exists
(
"dir1"
))
...
...
fs/tests/test_expose.py
View file @
c11e1f68
...
...
@@ -42,7 +42,8 @@ class TestRPCFS(unittest.TestCase,FSTestCases,ThreadingTestCases):
def
runServer
(
self
):
"""Run the server, swallowing shutdown-related execptions."""
self
.
server
.
socket
.
settimeout
(
0.1
)
if
sys
.
platform
!=
"win32"
:
self
.
server
.
socket
.
settimeout
(
0.1
)
try
:
while
self
.
serve_more_requests
:
self
.
server
.
handle_request
()
...
...
@@ -97,29 +98,33 @@ class TestSFTPFS(TestRPCFS):
pass
from
fs.expose
import
fuse
from
fs.osfs
import
OSFS
class
TestFUSE
(
unittest
.
TestCase
,
FSTestCases
,
ThreadingTestCases
):
def
setUp
(
self
):
self
.
temp_fs
=
TempFS
()
self
.
temp_fs
.
makedir
(
"root"
)
self
.
temp_fs
.
makedir
(
"mount"
)
self
.
mounted_fs
=
self
.
temp_fs
.
opendir
(
"root"
)
self
.
mount_point
=
self
.
temp_fs
.
getsyspath
(
"mount"
)
self
.
fs
=
OSFS
(
self
.
temp_fs
.
getsyspath
(
"mount"
))
self
.
mount_proc
=
fuse
.
mount
(
self
.
mounted_fs
,
self
.
mount_point
)
def
tearDown
(
self
):
self
.
mount_proc
.
unmount
()
try
:
self
.
temp_fs
.
close
()
except
OSError
:
# Sometimes FUSE hangs onto the mountpoint if mount_proc is
# forcibly killed. Shell out to fusermount to make sure.
fuse
.
unmount
(
self
.
mount_point
)
self
.
temp_fs
.
close
()
def
check
(
self
,
p
):
return
self
.
mounted_fs
.
exists
(
p
)
try
:
from
fs.expose
import
fuse
except
ImportError
:
pass
else
:
from
fs.osfs
import
OSFS
class
TestFUSE
(
unittest
.
TestCase
,
FSTestCases
,
ThreadingTestCases
):
def
setUp
(
self
):
self
.
temp_fs
=
TempFS
()
self
.
temp_fs
.
makedir
(
"root"
)
self
.
temp_fs
.
makedir
(
"mount"
)
self
.
mounted_fs
=
self
.
temp_fs
.
opendir
(
"root"
)
self
.
mount_point
=
self
.
temp_fs
.
getsyspath
(
"mount"
)
self
.
fs
=
OSFS
(
self
.
temp_fs
.
getsyspath
(
"mount"
))
self
.
mount_proc
=
fuse
.
mount
(
self
.
mounted_fs
,
self
.
mount_point
)
def
tearDown
(
self
):
self
.
mount_proc
.
unmount
()
try
:
self
.
temp_fs
.
close
()
except
OSError
:
# Sometimes FUSE hangs onto the mountpoint if mount_proc is
# forcibly killed. Shell out to fusermount to make sure.
fuse
.
unmount
(
self
.
mount_point
)
self
.
temp_fs
.
close
()
def
check
(
self
,
p
):
return
self
.
mounted_fs
.
exists
(
p
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment