@@ -182,6 +182,7 @@ def progress(file_name, total_size, sent_size):
182182 assert result
183183 assert result [- 1 ]["total_size" ] == result [- 1 ]["sent_size" ]
184184
185+
185186@pytest .fixture (scope = "function" )
186187def test_filepaths ():
187188 filepaths = [
@@ -194,6 +195,7 @@ def test_filepaths():
194195 ]
195196 yield filepaths
196197
198+
197199@pytest .fixture (scope = "function" )
198200def populated_device (device , test_filepaths ):
199201 dirpath = "toplevel/subdir1/subdir2"
@@ -206,25 +208,22 @@ def populated_device(device, test_filepaths):
206208
207209 device .shell ("rm -rf /data/local/tmp/toplevel" )
208210
211+
209212@pytest .fixture (scope = "function" )
210213def working_dir ():
211214 with tempfile .TemporaryDirectory () as f :
212215 yield pathlib .Path (f )
213216
217+
214218def test_pull_file (populated_device , working_dir ):
215- populated_device .pull (
216- "/data/local/tmp/toplevel/test1.txt" ,
217- working_dir
218- )
219+ populated_device .pull ("/data/local/tmp/toplevel/test1.txt" , working_dir )
219220 dest_path = working_dir / "test1.txt"
220221 assert dest_path .is_file ()
221222 assert dest_path .read_text () == "toplevel/test1.txt"
222223
224+
223225def test_pull_dir (populated_device , working_dir ):
224- populated_device .pull (
225- "/data/local/tmp/toplevel/subdir1/subdir2" ,
226- working_dir
227- )
226+ populated_device .pull ("/data/local/tmp/toplevel/subdir1/subdir2" , working_dir )
228227 dest_path = working_dir / "subdir2"
229228 filepath1 = dest_path / "test5.txt"
230229 filepath2 = dest_path / "test6.txt"
@@ -234,18 +233,17 @@ def test_pull_dir(populated_device, working_dir):
234233 assert filepath2 .is_file ()
235234 assert filepath2 .read_text () == "toplevel/subdir1/subdir2/test5.txt"
236235
236+
237237def test_pull_recursive_dir (populated_device , working_dir , test_filepaths ):
238- populated_device .pull (
239- "data/local/tmp/toplevel" ,
240- working_dir
241- )
238+ populated_device .pull ("data/local/tmp/toplevel" , working_dir )
242239 assert (working_dir / "toplevel" ).is_dir ()
243240 assert (working_dir / "toplevel" / "subdir1" ).is_dir ()
244241 for path in test_filepaths :
245242 to_check = working_dir / path
246243 assert to_check .is_file ()
247244 assert to_check .read_text () == path
248245
246+
249247def test_forward (device ):
250248 device .killforward_all ()
251249 forward_map = device .list_forward ()
0 commit comments