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
d4e33c63
Commit
d4e33c63
authored
Sep 27, 2010
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test_open_on_directory for SFTPFS
parent
6f3827d0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
fs/expose/dokan/__init__.py
+3
-7
fs/sftpfs.py
+3
-3
fs/tests/__init__.py
+9
-1
No files found.
fs/expose/dokan/__init__.py
View file @
d4e33c63
...
...
@@ -49,8 +49,6 @@ systems with Dokan installed.
# All rights reserved; available under the terms of the MIT License.
import
sys
if
sys
.
platform
!=
"win32"
:
raise
ImportError
(
"Dokan is only available on win32"
)
import
os
import
signal
...
...
@@ -61,9 +59,6 @@ import subprocess
import
pickle
import
datetime
import
ctypes
from
ctypes.wintypes
import
LPCWSTR
,
WCHAR
kernel32
=
ctypes
.
windll
.
kernel32
from
fs.base
import
threading
from
fs.errors
import
*
...
...
@@ -72,13 +67,14 @@ from fs.local_functools import wraps
try
:
import
libdokan
except
(
NotImplementedError
,
EnvironmentError
,
ImportError
):
except
(
NotImplementedError
,
EnvironmentError
,
ImportError
,
NameError
,
):
is_available
=
False
sys
.
modules
.
pop
(
"fs.expose.dokan.libdokan"
,
None
)
libdokan
=
None
else
:
is_available
=
True
from
ctypes.wintypes
import
LPCWSTR
,
WCHAR
kernel32
=
ctypes
.
windll
.
kernel32
# Options controlling the behaiour of the Dokan filesystem
DOKAN_OPTION_DEBUG
=
1
...
...
fs/sftpfs.py
View file @
d4e33c63
...
...
@@ -136,12 +136,12 @@ class SFTPFS(FS):
@convert_os_errors
def
open
(
self
,
path
,
mode
=
"r"
,
bufsize
=-
1
):
npath
=
self
.
_normpath
(
path
)
# paramiko implements its own buffering and write-back logic,
# so we don't need to use a RemoteFileBuffer here.
f
=
self
.
client
.
open
(
npath
,
mode
,
bufsize
)
if
self
.
isdir
(
path
):
msg
=
"that's a directory:
%(path)
s"
raise
ResourceInvalidError
(
path
,
msg
=
msg
)
# paramiko implements its own buffering and write-back logic,
# so we don't need to use a RemoteFileBuffer here.
f
=
self
.
client
.
open
(
npath
,
mode
,
bufsize
)
return
f
@convert_os_errors
...
...
fs/tests/__init__.py
View file @
d4e33c63
...
...
@@ -70,7 +70,15 @@ class FSTestCases(object):
def
test_open_on_directory
(
self
):
self
.
fs
.
makedir
(
"testdir"
)
self
.
assertRaises
(
ResourceInvalidError
,
self
.
fs
.
open
,
"testdir"
)
try
:
self
.
fs
.
open
(
"testdir"
)
except
ResourceInvalidError
:
pass
except
Exception
:
ecls
=
sys
.
exc_info
[
0
]
assert
False
,
"
%
s raised instead of ResourceInvalidError"
%
(
ecls
,)
else
:
assert
False
,
"ResourceInvalidError was not raised"
def
test_writefile
(
self
):
self
.
assertRaises
(
ResourceNotFoundError
,
self
.
fs
.
open
,
"test1.txt"
)
...
...
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