Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
paramiko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenVMS
Python
Modules
paramiko
Commits
a15ad041471e
Commit
a15ad041471e
authored
12 years ago
by
Jeff Forcier
Browse files
Options
Downloads
Plain Diff
Merge branch '1.10'
Conflicts: NEWS
parents
1204062b7da8
41c0ee3553bd
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
NEWS
+6
-0
6 additions, 0 deletions
NEWS
paramiko/sftp_client.py
+1
-1
1 addition, 1 deletion
paramiko/sftp_client.py
tests/test_sftp.py
+20
-12
20 additions, 12 deletions
tests/test_sftp.py
with
27 additions
and
13 deletions
NEWS
+
6
−
0
View file @
a15ad041
...
@@ -25,6 +25,12 @@
...
@@ -25,6 +25,12 @@
implementations of all functionality. Thanks to Jason R. Coombs for the
implementations of all functionality. Thanks to Jason R. Coombs for the
patch.
patch.
v1.10.1 (DD MM YYYY)
--------------------
* #142: (Fabric #811) SFTP put of empty file will still return the attributes
of the put file. Thanks to Jason R. Coombs for the patch.
v1.10.0 (1st Mar 2013)
v1.10.0 (1st Mar 2013)
--------------------
--------------------
...
...
This diff is collapsed.
Click to expand it.
paramiko/sftp_client.py
+
1
−
1
View file @
a15ad041
...
@@ -575,7 +575,7 @@
...
@@ -575,7 +575,7 @@
break
break
finally
:
finally
:
fr
.
close
()
fr
.
close
()
if
confirm
and
file_size
:
if
confirm
:
s
=
self
.
stat
(
remotepath
)
s
=
self
.
stat
(
remotepath
)
if
s
.
st_size
!=
size
:
if
s
.
st_size
!=
size
:
raise
IOError
(
'
size mismatch in put! %d != %d
'
%
(
s
.
st_size
,
size
))
raise
IOError
(
'
size mismatch in put! %d != %d
'
%
(
s
.
st_size
,
size
))
...
...
This diff is collapsed.
Click to expand it.
tests/test_sftp.py
+
20
−
12
View file @
a15ad041
...
@@ -26,5 +26,4 @@
...
@@ -26,5 +26,4 @@
from
__future__
import
with_statement
from
__future__
import
with_statement
from
binascii
import
hexlify
from
binascii
import
hexlify
import
logging
import
os
import
os
...
@@ -30,5 +29,4 @@
...
@@ -30,5 +29,4 @@
import
os
import
os
import
random
import
warnings
import
struct
import
sys
import
sys
import
threading
import
threading
...
@@ -33,4 +31,3 @@
...
@@ -33,4 +31,3 @@
import
sys
import
sys
import
threading
import
threading
import
time
import
unittest
import
unittest
...
@@ -36,4 +33,5 @@
...
@@ -36,4 +33,5 @@
import
unittest
import
unittest
import
StringIO
import
paramiko
import
paramiko
from
stub_sftp
import
StubServer
,
StubSFTPServer
from
stub_sftp
import
StubServer
,
StubSFTPServer
...
@@ -227,7 +225,7 @@
...
@@ -227,7 +225,7 @@
"""
"""
f
=
sftp
.
open
(
FOLDER
+
'
/first.txt
'
,
'
w
'
)
f
=
sftp
.
open
(
FOLDER
+
'
/first.txt
'
,
'
w
'
)
try
:
try
:
f
.
write
(
'
content!
\n
'
)
;
f
.
write
(
'
content!
\n
'
)
f
.
close
()
f
.
close
()
sftp
.
rename
(
FOLDER
+
'
/first.txt
'
,
FOLDER
+
'
/second.txt
'
)
sftp
.
rename
(
FOLDER
+
'
/first.txt
'
,
FOLDER
+
'
/second.txt
'
)
try
:
try
:
...
@@ -566,7 +564,6 @@
...
@@ -566,7 +564,6 @@
"""
"""
verify that get/put work.
verify that get/put work.
"""
"""
import
os
,
warnings
warnings
.
filterwarnings
(
'
ignore
'
,
'
tempnam.*
'
)
warnings
.
filterwarnings
(
'
ignore
'
,
'
tempnam.*
'
)
localname
=
os
.
tempnam
()
localname
=
os
.
tempnam
()
...
@@ -631,7 +628,7 @@
...
@@ -631,7 +628,7 @@
try
:
try
:
f
=
sftp
.
open
(
FOLDER
+
'
/unusual.txt
'
,
'
wx
'
)
f
=
sftp
.
open
(
FOLDER
+
'
/unusual.txt
'
,
'
wx
'
)
self
.
fail
(
'
expected exception
'
)
self
.
fail
(
'
expected exception
'
)
except
IOError
,
x
:
except
IOError
:
pass
pass
finally
:
finally
:
sftp
.
unlink
(
FOLDER
+
'
/unusual.txt
'
)
sftp
.
unlink
(
FOLDER
+
'
/unusual.txt
'
)
...
@@ -671,8 +668,8 @@
...
@@ -671,8 +668,8 @@
f
.
close
()
f
.
close
()
try
:
try
:
f
=
sftp
.
open
(
FOLDER
+
'
/zero
'
,
'
r
'
)
f
=
sftp
.
open
(
FOLDER
+
'
/zero
'
,
'
r
'
)
data
=
f
.
readv
([(
0
,
12
)])
f
.
readv
([(
0
,
12
)])
f
.
close
()
f
.
close
()
f
=
sftp
.
open
(
FOLDER
+
'
/zero
'
,
'
r
'
)
f
=
sftp
.
open
(
FOLDER
+
'
/zero
'
,
'
r
'
)
f
.
prefetch
()
f
.
prefetch
()
...
@@ -675,8 +672,8 @@
...
@@ -675,8 +672,8 @@
f
.
close
()
f
.
close
()
f
=
sftp
.
open
(
FOLDER
+
'
/zero
'
,
'
r
'
)
f
=
sftp
.
open
(
FOLDER
+
'
/zero
'
,
'
r
'
)
f
.
prefetch
()
f
.
prefetch
()
data
=
f
.
read
(
100
)
f
.
read
(
100
)
f
.
close
()
f
.
close
()
finally
:
finally
:
sftp
.
unlink
(
FOLDER
+
'
/zero
'
)
sftp
.
unlink
(
FOLDER
+
'
/zero
'
)
...
@@ -685,7 +682,6 @@
...
@@ -685,7 +682,6 @@
"""
"""
verify that get/put work without confirmation.
verify that get/put work without confirmation.
"""
"""
import
os
,
warnings
warnings
.
filterwarnings
(
'
ignore
'
,
'
tempnam.*
'
)
warnings
.
filterwarnings
(
'
ignore
'
,
'
tempnam.*
'
)
localname
=
os
.
tempnam
()
localname
=
os
.
tempnam
()
...
@@ -730,3 +726,15 @@
...
@@ -730,3 +726,15 @@
finally
:
finally
:
sftp
.
remove
(
FOLDER
+
'
/append.txt
'
)
sftp
.
remove
(
FOLDER
+
'
/append.txt
'
)
def
test_putfo_empty_file
(
self
):
"""
Send an empty file and confirm it is sent.
"""
target
=
FOLDER
+
'
/empty file.txt
'
stream
=
StringIO
.
StringIO
()
try
:
attrs
=
sftp
.
putfo
(
stream
,
target
)
# the returned attributes should not be null
self
.
assertNotEqual
(
attrs
,
None
)
finally
:
sftp
.
remove
(
target
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment