aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-10-12 18:16:07 +0000
committerng0 <ng0@n0.is>2019-10-12 18:16:07 +0000
commita5f5e7ed9b07b902af4438d76087e034abcba9b2 (patch)
tree6f376f93f1c785103d0b30f54311a0f61d2bdced /src/fs
parent8e827de2a1db34dfe15f5f9da2850ca469b5ecc3 (diff)
downloadgnunet-a5f5e7ed9b07b902af4438d76087e034abcba9b2.tar.gz
gnunet-a5f5e7ed9b07b902af4438d76087e034abcba9b2.zip
format python
Diffstat (limited to 'src/fs')
-rwxr-xr-xsrc/fs/test_gnunet_fs_idx.py.in57
-rwxr-xr-xsrc/fs/test_gnunet_fs_psd.py.in75
-rwxr-xr-xsrc/fs/test_gnunet_fs_rec.py.in90
3 files changed, 183 insertions, 39 deletions
diff --git a/src/fs/test_gnunet_fs_idx.py.in b/src/fs/test_gnunet_fs_idx.py.in
index 4798cf503..2c8c7e8ec 100755
--- a/src/fs/test_gnunet_fs_idx.py.in
+++ b/src/fs/test_gnunet_fs_idx.py.in
@@ -11,7 +11,7 @@
11# WITHOUT ANY WARRANTY; without even the implied warranty of 11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Affero General Public License for more details. 13# Affero General Public License for more details.
14# 14#
15# You should have received a copy of the GNU Affero General Public License 15# You should have received a copy of the GNU Affero General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>. 16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17# 17#
@@ -43,7 +43,9 @@ elif os.name == 'nt':
43 unindex = './gnunet-unindex.exe' 43 unindex = './gnunet-unindex.exe'
44 44
45if os.name == "nt": 45if os.name == "nt":
46 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-idx"), True) 46 shutil.rmtree(
47 os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-idx"), True
48 )
47else: 49else:
48 shutil.rmtree("/tmp/gnunet-test-fs-py-idx", True) 50 shutil.rmtree("/tmp/gnunet-test-fs-py-idx", True)
49 51
@@ -53,22 +55,59 @@ arm.communicate()
53try: 55try:
54 pub = pexpect() 56 pub = pexpect()
55 57
56 pub.spawn(None, [publish, '-c', 'test_gnunet_fs_idx_data.conf', '-m', "description:Test archive", '-k', 'tst', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 58 pub.spawn(
57 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR\.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG\.17822'\.\r?\n")) 59 None, [
60 publish, '-c', 'test_gnunet_fs_idx_data.conf', '-m',
61 "description:Test archive", '-k', 'tst',
62 'test_gnunet_fs_rec_data.tgz'
63 ],
64 stdout=subprocess.PIPE,
65 stderr=subprocess.STDOUT
66 )
67 pub.expect(
68 "stdout",
69 re.compile(
70 r"URI is `gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR\.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG\.17822'\.\r?\n"
71 )
72 )
58 73
59 down = pexpect() 74 down = pexpect()
60 down.spawn(None, [download, '-c', 'test_gnunet_fs_idx_data.conf', '-o', 'test_gnunet_fs_rec_data.tar.gz', 'gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG.17822'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 75 down.spawn(
61 down.expect("stdout", re.compile(r"Downloading `test_gnunet_fs_rec_data.tar.gz' done (.*).\r?\n")) 76 None, [
77 download, '-c', 'test_gnunet_fs_idx_data.conf', '-o',
78 'test_gnunet_fs_rec_data.tar.gz',
79 'gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG.17822'
80 ],
81 stdout=subprocess.PIPE,
82 stderr=subprocess.STDOUT
83 )
84 down.expect(
85 "stdout",
86 re.compile(
87 r"Downloading `test_gnunet_fs_rec_data.tar.gz' done (.*).\r?\n"
88 )
89 )
62 os.remove("test_gnunet_fs_rec_data.tar.gz") 90 os.remove("test_gnunet_fs_rec_data.tar.gz")
63 91
64 un = pexpect() 92 un = pexpect()
65 un.spawn(None, [unindex, '-c', 'test_gnunet_fs_idx_data.conf', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 93 un.spawn(
94 None, [
95 unindex, '-c', 'test_gnunet_fs_idx_data.conf',
96 'test_gnunet_fs_rec_data.tgz'
97 ],
98 stdout=subprocess.PIPE,
99 stderr=subprocess.STDOUT
100 )
66 un.expect("stdout", re.compile(r'Unindexing done\.\r?\n')) 101 un.expect("stdout", re.compile(r'Unindexing done\.\r?\n'))
67 102
68finally: 103finally:
69 arm = subprocess.Popen([gnunetarm, '-eq', '-c', 'test_gnunet_fs_idx_data.conf']) 104 arm = subprocess.Popen([
105 gnunetarm, '-eq', '-c', 'test_gnunet_fs_idx_data.conf'
106 ])
70 arm.communicate() 107 arm.communicate()
71 if os.name == "nt": 108 if os.name == "nt":
72 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-idx"), True) 109 shutil.rmtree(
110 os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-idx"), True
111 )
73 else: 112 else:
74 shutil.rmtree("/tmp/gnunet-test-fs-py-idx", True) 113 shutil.rmtree("/tmp/gnunet-test-fs-py-idx", True)
diff --git a/src/fs/test_gnunet_fs_psd.py.in b/src/fs/test_gnunet_fs_psd.py.in
index a1e4db9d5..abb3d0b83 100755
--- a/src/fs/test_gnunet_fs_psd.py.in
+++ b/src/fs/test_gnunet_fs_psd.py.in
@@ -11,7 +11,7 @@
11# WITHOUT ANY WARRANTY; without even the implied warranty of 11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Affero General Public License for more details. 13# Affero General Public License for more details.
14# 14#
15# You should have received a copy of the GNU Affero General Public License 15# You should have received a copy of the GNU Affero General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>. 16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17# 17#
@@ -38,8 +38,8 @@ except NameError:
38reload(sys) 38reload(sys)
39 39
40# Force encoding to utf-8, as this test otherwise fails 40# Force encoding to utf-8, as this test otherwise fails
41# on some systems (see #5094). In Python 3+ there is no attribute 41# on some systems (see #5094). In Python 3+ there is no attribute
42# sys.setdefaultencoding anymore. 42# sys.setdefaultencoding anymore.
43if (3 < sys.version_info[0]): 43if (3 < sys.version_info[0]):
44 sys.setdefaultencoding('utf8') 44 sys.setdefaultencoding('utf8')
45 45
@@ -68,9 +68,11 @@ if "GNUNET_PREFIX" in os.environ:
68else: 68else:
69 print("You need to export GNUNET_PREFIX") 69 print("You need to export GNUNET_PREFIX")
70 sys.exit(1) 70 sys.exit(1)
71 71
72if os.name == "nt": 72if os.name == "nt":
73 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-psd"), True) 73 shutil.rmtree(
74 os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-psd"), True
75 )
74else: 76else:
75 shutil.rmtree("/tmp/gnunet-test-fs-py-psd", True) 77 shutil.rmtree("/tmp/gnunet-test-fs-py-psd", True)
76 78
@@ -80,23 +82,68 @@ arm.communicate()
80# first, basic publish-search-download run 82# first, basic publish-search-download run
81try: 83try:
82 pub = pexpect() 84 pub = pexpect()
83 pub.spawn(None, [publish, '-c', 'test_gnunet_fs_psd_data.conf', '-n', '-m', "description:Test archive", '-k', 'tst', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 85 pub.spawn(
84 pub.expect("stdout", re.compile(r"Publishing `.+test_gnunet_fs_rec_data.tgz' done\.\r?\n")) 86 None, [
85 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR\.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG\.17822'\.\r?\n")) 87 publish, '-c', 'test_gnunet_fs_psd_data.conf', '-n', '-m',
88 "description:Test archive", '-k', 'tst',
89 'test_gnunet_fs_rec_data.tgz'
90 ],
91 stdout=subprocess.PIPE,
92 stderr=subprocess.STDOUT
93 )
94 pub.expect(
95 "stdout",
96 re.compile(r"Publishing `.+test_gnunet_fs_rec_data.tgz' done\.\r?\n")
97 )
98 pub.expect(
99 "stdout",
100 re.compile(
101 r"URI is `gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR\.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG\.17822'\.\r?\n"
102 )
103 )
86 104
87 s = pexpect() 105 s = pexpect()
88 s.spawn(None, [search, '-V', '-t', '1000 ms', '-N', '1', '-c', 'test_gnunet_fs_psd_data.conf', 'tst'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 106 s.spawn(
89 s.expect("stdout", re.compile(r'gnunet-download -o "test_gnunet_fs_rec_data.tgz" gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR\.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG\.17822\r?\n')) 107 None, [
108 search, '-V', '-t', '1000 ms', '-N', '1', '-c',
109 'test_gnunet_fs_psd_data.conf', 'tst'
110 ],
111 stdout=subprocess.PIPE,
112 stderr=subprocess.STDOUT
113 )
114 s.expect(
115 "stdout",
116 re.compile(
117 r'gnunet-download -o "test_gnunet_fs_rec_data.tgz" gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR\.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG\.17822\r?\n'
118 )
119 )
90 120
91 down = pexpect() 121 down = pexpect()
92 down.spawn(None, [download, '-c', 'test_gnunet_fs_psd_data.conf', '-o', 'test_gnunet_fs_rec_data.tar.gz', 'gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG.17822'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 122 down.spawn(
93 down.expect("stdout", re.compile(r"Downloading `test_gnunet_fs_rec_data.tar.gz' done (.*).\r?\n")) 123 None, [
124 download, '-c', 'test_gnunet_fs_psd_data.conf', '-o',
125 'test_gnunet_fs_rec_data.tar.gz',
126 'gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG.17822'
127 ],
128 stdout=subprocess.PIPE,
129 stderr=subprocess.STDOUT
130 )
131 down.expect(
132 "stdout",
133 re.compile(
134 r"Downloading `test_gnunet_fs_rec_data.tar.gz' done (.*).\r?\n"
135 )
136 )
94 os.remove("test_gnunet_fs_rec_data.tar.gz") 137 os.remove("test_gnunet_fs_rec_data.tar.gz")
95 138
96finally: 139finally:
97 arm = subprocess.Popen([gnunetarm, '-eq', '-c', 'test_gnunet_fs_psd_data.conf']) 140 arm = subprocess.Popen([
141 gnunetarm, '-eq', '-c', 'test_gnunet_fs_psd_data.conf'
142 ])
98 arm.communicate() 143 arm.communicate()
99 if os.name == "nt": 144 if os.name == "nt":
100 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-psd"), True) 145 shutil.rmtree(
146 os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-psd"), True
147 )
101 else: 148 else:
102 shutil.rmtree("/tmp/gnunet-test-fs-py-psd", True) 149 shutil.rmtree("/tmp/gnunet-test-fs-py-psd", True)
diff --git a/src/fs/test_gnunet_fs_rec.py.in b/src/fs/test_gnunet_fs_rec.py.in
index 0f881564f..0e1512b26 100755
--- a/src/fs/test_gnunet_fs_rec.py.in
+++ b/src/fs/test_gnunet_fs_rec.py.in
@@ -50,7 +50,9 @@ elif os.name == 'nt':
50 directory = './gnunet-directory.exe' 50 directory = './gnunet-directory.exe'
51 51
52if os.name == "nt": 52if os.name == "nt":
53 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-rec"), True) 53 shutil.rmtree(
54 os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-rec"), True
55 )
54else: 56else:
55 shutil.rmtree("/tmp/gnunet-test-fs-py-rec", True) 57 shutil.rmtree("/tmp/gnunet-test-fs-py-rec", True)
56 58
@@ -65,33 +67,83 @@ tar.extractall()
65# first, basic publish-search-download run 67# first, basic publish-search-download run
66try: 68try:
67 pub = pexpect() 69 pub = pexpect()
68 pub.spawn(None, [publish, '-c', 'test_gnunet_fs_rec_data.conf', '-k', 'testdir', 'dir/'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 70 pub.spawn(
71 None, [
72 publish, '-c', 'test_gnunet_fs_rec_data.conf', '-k', 'testdir',
73 'dir/'
74 ],
75 stdout=subprocess.PIPE,
76 stderr=subprocess.STDOUT
77 )
69 # Can't say much for publishing, except that the last one is the toplevel directory 78 # Can't say much for publishing, except that the last one is the toplevel directory
70 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n")) 79 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
71 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 80 pub.expect(
81 "stdout",
82 re.compile(
83 r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"
84 )
85 )
72 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n")) 86 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
73 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 87 pub.expect(
88 "stdout",
89 re.compile(
90 r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"
91 )
92 )
74 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n")) 93 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
75 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 94 pub.expect(
95 "stdout",
96 re.compile(
97 r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"
98 )
99 )
76 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n")) 100 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
77 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 101 pub.expect(
102 "stdout",
103 re.compile(
104 r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"
105 )
106 )
78 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n")) 107 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
79 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 108 pub.expect(
109 "stdout",
110 re.compile(
111 r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"
112 )
113 )
80 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n")) 114 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
81 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 115 pub.expect(
82 pub.expect("stdout", re.compile(r"Publishing `.+[\\/]dir[\\/]' done\.\r?\n")) 116 "stdout",
117 re.compile(
118 r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"
119 )
120 )
121 pub.expect(
122 "stdout", re.compile(r"Publishing `.+[\\/]dir[\\/]' done\.\r?\n")
123 )
83 m = pub.expect("stdout", re.compile(r".+\r?\n")) 124 m = pub.expect("stdout", re.compile(r".+\r?\n"))
84 if not m: 125 if not m:
85 sys.exit(3) 126 sys.exit(3)
86 output = m.string 127 output = m.string
87 url = output[output.find("`")+1:output.find("'")] 128 url = output[output.find("`") + 1:output.find("'")]
88 129
89 down = pexpect() 130 down = pexpect()
90 down.spawn(None, [download, '-c', 'test_gnunet_fs_rec_data.conf', '-R', '-o', 'rdir.gnd', url], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 131 down.spawn(
132 None, [
133 download, '-c', 'test_gnunet_fs_rec_data.conf', '-R', '-o',
134 'rdir.gnd', url
135 ],
136 stdout=subprocess.PIPE,
137 stderr=subprocess.STDOUT
138 )
91 down.expect("stdout", re.compile(r"Downloading `rdir.gnd' done (.*).\r?\n")) 139 down.expect("stdout", re.compile(r"Downloading `rdir.gnd' done (.*).\r?\n"))
92 140
93 d = pexpect() 141 d = pexpect()
94 d.spawn(None, [directory, '-c', 'test_gnunet_fs_rec_data.conf', 'rdir/a.gnd'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 142 d.spawn(
143 None, [directory, '-c', 'test_gnunet_fs_rec_data.conf', 'rdir/a.gnd'],
144 stdout=subprocess.PIPE,
145 stderr=subprocess.STDOUT
146 )
95 d.expect("stdout", re.compile(r"Directory `a/' meta data:\r?\n")) 147 d.expect("stdout", re.compile(r"Directory `a/' meta data:\r?\n"))
96 d.expect("stdout", re.compile(r"Directory `a/' contents:\r?\n")) 148 d.expect("stdout", re.compile(r"Directory `a/' contents:\r?\n"))
97 d.expect("stdout", re.compile(r"COPYING (.*)\r?\n")) 149 d.expect("stdout", re.compile(r"COPYING (.*)\r?\n"))
@@ -101,14 +153,20 @@ try:
101 os.remove("rdir/a.gnd") 153 os.remove("rdir/a.gnd")
102 diff = dcdiff('dir', 'rdir') 154 diff = dcdiff('dir', 'rdir')
103 if len(diff) != 0: 155 if len(diff) != 0:
104 raise Exception("Unexpected difference between source directory and downloaded result:\n{}".format(diff)) 156 raise Exception(
105 157 "Unexpected difference between source directory and downloaded result:\n{}"
158 .format(diff)
159 )
106 160
107finally: 161finally:
108 arm = subprocess.Popen([gnunetarm, '-eq', '-c', 'test_gnunet_fs_rec_data.conf']) 162 arm = subprocess.Popen([
163 gnunetarm, '-eq', '-c', 'test_gnunet_fs_rec_data.conf'
164 ])
109 arm.communicate() 165 arm.communicate()
110 if os.name == "nt": 166 if os.name == "nt":
111 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-rec"), True) 167 shutil.rmtree(
168 os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-rec"), True
169 )
112 else: 170 else:
113 shutil.rmtree("/tmp/gnunet-test-fs-py-rec", True) 171 shutil.rmtree("/tmp/gnunet-test-fs-py-rec", True)
114 shutil.rmtree("dir", True) 172 shutil.rmtree("dir", True)