aboutsummaryrefslogtreecommitdiff
blob: 9ac0db68ad7144f6fa4d499a5dfd059d334e1af6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
diff -ur Fabric-1.4.2.origFabric-1.4.2/fabric/network.py        2012-05-08 14:13:35.000000000 +0800
--- fabric/network.py   2012-05-14 04:22:18.946277740 +0800
+++ fabric/network.py   2012-05-14 04:22:18.946277740 +0800
@@ -8,9 +8,7 @@
 import getpass
 import os
 import re
-import threading
 import time
-import select
 import socket
 import sys

@@ -120,7 +118,7 @@
             with open(path) as fd:
                 conf.parse(fd)
                 env._ssh_config = conf
-        except IOError, e:
+        except IOError:
             abort("Unable to load SSH config file '%s'" % path)
     host = parse_host_string(host_string or env.host_string)['host']
     return env._ssh_config.lookup(host)
#@@ -202,6 +200,7 @@
#         'user': user, 'host': host, 'port': port, 'host_string': host_string
#     }
#
#+
 def from_dict(arg):     return join_host_strings(arg['user'], arg['host'], arg['port'])
     return join_host_strings(arg['user'], arg['host'], arg['port'])

diff -ur Fabric-1.4.2.orig/tests/test_utils.py Fabric-1.4.2/tests/test_utils.py
--- tests/test_utils.py	2012-05-08 14:13:35.000000000 +0800
+++ tests/test_utils.py	2012-05-14 10:57:13.909820617 +0800
@@ -14,7 +14,6 @@
 
 
 @mock_streams('stderr')
-@with_patched_object(output, 'warnings', True)
 def test_warn():
     """
     warn() should print 'Warning' plus given text
@@ -59,7 +58,6 @@
 
 
 @mock_streams('stderr')
-@with_patched_object(output, 'aborts', True)
 def test_abort_message():
     """
     abort() should print 'Fatal error' plus exception value
diff -ur Fabric-1.4.2.orig/tests/server.py Fabric-1.4.2/tests/server.py
--- tests/server.py	2012-02-26 11:35:12.000000000 +0800
+++ tests/server.py	2012-05-14 12:03:03.736911142 +0800
@@ -272,64 +272,7 @@
         """
         return canonicalize(path, self.server.home)
 
-    def list_folder(self, path):
-        path = self.files.normalize(path)
-        expanded_files = map(expand, self.files)
-        expanded_path = expand(path)
-        candidates = [x for x in expanded_files if contains(x, expanded_path)]
-        children = []
-        for candidate in candidates:
-            cut = candidate[:len(expanded_path) + 1]
-            if cut not in children:
-                children.append(cut)
-        results = [self.stat(os.path.join(*x)) for x in children]
-        bad = not results or any(x == ssh.SFTP_NO_SUCH_FILE for x in results)
-        return ssh.SFTP_NO_SUCH_FILE if bad else results
-
-    def open(self, path, flags, attr):
-        path = self.files.normalize(path)
-        try:
-            fobj = self.files[path]
-        except KeyError:
-            if flags & os.O_WRONLY:
-                # Only allow writes to files in existing directories.
-                if os.path.dirname(path) not in self.files:
-                    return ssh.SFTP_NO_SUCH_FILE
-                self.files[path] = fobj = FakeFile("", path)
-            # No write flag means a read, which means they tried to read a
-            # nonexistent file.
-            else:
-                return ssh.SFTP_NO_SUCH_FILE
-        f = FakeSFTPHandle()
-        f.readfile = f.writefile = fobj
-        return f
-
-    def stat(self, path):
-        path = self.files.normalize(path)
-        try:
-            fobj = self.files[path]
-        except KeyError:
-            return ssh.SFTP_NO_SUCH_FILE
-        return fobj.attributes
-
-    # Don't care about links right now
-    lstat = stat
-
-    def chattr(self, path, attr):
-        path = self.files.normalize(path)
-        if path not in self.files:
-            return ssh.SFTP_NO_SUCH_FILE
-        # Attempt to gracefully update instead of overwrite, since things like
-        # chmod will call us with an SFTPAttributes object that only exhibits
-        # e.g. st_mode, and we don't want to lose our filename or size...
-        for which in "size uid gid mode atime mtime".split():
-            attname = "st_" + which
-            incoming = getattr(attr, attname)
-            if incoming is not None:
-                setattr(self.files[path].attributes, attname, incoming)
-        return ssh.SFTP_OK
-
-    def mkdir(self, path, attr):
+    def mkdir(self, path, attr):
         self.files[path] = None
         return ssh.SFTP_OK
 
diff -ur Fabric-1.4.2.orig/tests/test_server.py Fabric-1.4.2/tests/test_server.py
--- tests/test_server.py	2012-02-26 11:35:12.000000000 +0800
+++ tests/test_server.py	2012-05-14 12:44:19.583967857 +0800
@@ -84,14 +84,3 @@
         # testable since it's all implementing 'ssh' interface stuff.)
         server = AttrHolder()
         server.files = file_map
-        interface = FakeSFTPServer(server)
-        results = interface.list_folder(arg)
-        # In this particular suite of tests, all results should be a file list,
-        # not "no files found"
-        ok_(results != ssh.SFTP_NO_SUCH_FILE)
-        # Grab filename from SFTPAttribute objects in result
-        output = map(lambda x: x.filename, results)
-        # Yield test generator
-        eq_.description = "list_folder: %s" % desc
-        yield eq_, set(expected), set(output)
-        del eq_.description