Skip to content

Commit 493a07e

Browse files
committed
fix the pwd expectation in get_r tests now that we utilize _cache.cwd
1 parent f665b8f commit 493a07e

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

tests/test_get_r.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ def test_get_r(sftpserver):
1111
with sftpserver.serve_content(VFS):
1212
with Connection(**conn(sftpserver)) as sftp:
1313
localpath = Path(mkdtemp()).as_posix()
14-
sftp.get_r('.', localpath)
14+
remotepath = '.'
15+
sftp.get_r(remotepath, localpath)
1516

1617
local_tree = {}
1718
remote_tree = {}
1819

19-
remote_cwd = sftp.pwd
20+
remote_cwd = Path(sftp.pwd).joinpath(remotepath).as_posix()
2021

2122
localtree(local_tree, localpath, remote_cwd)
2223
sftp.remotetree(remote_tree, remote_cwd, localpath)
@@ -35,12 +36,13 @@ def test_get_r_pwd(sftpserver):
3536
with sftpserver.serve_content(VFS):
3637
with Connection(**conn(sftpserver)) as sftp:
3738
localpath = Path(mkdtemp()).as_posix()
38-
sftp.get_r('pub/foo2', localpath)
39+
remotepath = 'pub/foo2'
40+
sftp.get_r(remotepath, localpath)
3941

4042
local_tree = {}
4143
remote_tree = {}
4244

43-
remote_cwd = sftp.pwd
45+
remote_cwd = Path(sftp.pwd).joinpath(remotepath).as_posix()
4446

4547
localtree(local_tree, localpath, remote_cwd)
4648
sftp.remotetree(remote_tree, remote_cwd, localpath)
@@ -58,14 +60,15 @@ def test_get_r_pathed(sftpserver):
5860
'''test the get_r for localpath, starting deeper then pwd '''
5961
with sftpserver.serve_content(VFS):
6062
with Connection(**conn(sftpserver)) as sftp:
61-
sftp.chdir('pub/foo2')
6263
localpath = Path(mkdtemp()).as_posix()
63-
sftp.get_r('./bar1', localpath)
64+
remotepath = './bar1'
65+
sftp.chdir('pub/foo2')
66+
sftp.get_r(remotepath, localpath)
6467

6568
local_tree = {}
6669
remote_tree = {}
6770

68-
remote_cwd = sftp.pwd
71+
remote_cwd = Path(sftp.pwd).joinpath(remotepath).as_posix()
6972

7073
localtree(local_tree, localpath, remote_cwd)
7174
sftp.remotetree(remote_tree, remote_cwd, localpath)
@@ -86,13 +89,14 @@ def test_get_r_cdd(sftpserver):
8689
with sftpserver.serve_content(VFS):
8790
with Connection(**conn(sftpserver)) as sftp:
8891
localpath = Path(mkdtemp()).as_posix()
92+
remotepath = '.'
8993
sftp.chdir('pub/foo2')
90-
sftp.get_r('.', localpath)
94+
sftp.get_r(remotepath, localpath)
9195

9296
local_tree = {}
9397
remote_tree = {}
9498

95-
remote_cwd = sftp.pwd
99+
remote_cwd = Path(sftp.pwd).joinpath(remotepath).as_posix()
96100

97101
localtree(local_tree, localpath, remote_cwd)
98102
sftp.remotetree(remote_tree, remote_cwd, localpath)

0 commit comments

Comments
 (0)