88 assert_bash_exec ,
99 assert_complete ,
1010 bash_env_saved ,
11+ get_testdir ,
1112 prepare_fixture_dir ,
1213)
1314
@@ -119,15 +120,15 @@ def test_remote_path_with_spaces(self, bash):
119120 assert_bash_exec (bash , "unset -f ssh" )
120121 assert completion == r"\\\ in\\\ filename.txt"
121122
122- def test_xfunc_remote_files (self , bash ):
123+ def test_xfunc_remote_files (self , live_pwd , bash ):
124+ def prefix_paths (prefix , paths ):
125+ return [f"{ prefix } { path } " for path in paths ]
126+
123127 with bash_env_saved (bash ) as bash_env :
124128 bash_env .save_variable ("COMPREPLY" )
125129 bash_env .write_variable (
126- "PATH" ,
127- "$PWD/scp/bin:$PATH" ,
128- quote = False ,
130+ "cur" , f"{ LIVE_HOST } :{ get_testdir ()} /fixtures/shared/default/"
129131 )
130- bash_env .write_variable ("cur" , "local:shared/default/" )
131132 completions_regular_escape = (
132133 assert_bash_exec (
133134 bash ,
@@ -146,18 +147,24 @@ def test_xfunc_remote_files(self, bash):
146147 .strip ()
147148 .splitlines ()
148149 )
149- assert completions_regular_escape == [
150- "shared/default/bar " ,
151- r"shared/default/bar\\\ bar.d/" ,
152- "shared/default/foo " ,
153- "shared/default/foo.d/" ,
154- ]
155- assert completions_less_escape == [
156- "shared/default/bar " ,
157- r"shared/default/bar\ bar.d/" ,
158- "shared/default/foo " ,
159- "shared/default/foo.d/" ,
160- ]
150+ assert completions_regular_escape == prefix_paths (
151+ f"{ get_testdir ()} /fixtures/shared/default/" ,
152+ [
153+ "bar " ,
154+ r"bar\\\ bar.d/" ,
155+ "foo " ,
156+ "foo.d/" ,
157+ ],
158+ )
159+ assert completions_less_escape == prefix_paths (
160+ f"{ get_testdir ()} /fixtures/shared/default/" ,
161+ [
162+ "bar " ,
163+ r"bar\ bar.d/" ,
164+ "foo " ,
165+ "foo.d/" ,
166+ ],
167+ )
161168
162169 @pytest .fixture
163170 def tmpdir_backslash (self , request , bash ):
0 commit comments