Skip to content

Commit 670c120

Browse files
akinomyogascop
authored andcommitted
test(scp): create files on the fly to work around Windoes filesystem
1 parent 50f5872 commit 670c120

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

test/fixtures/scp/local_path/backslash-a b.txt

Whitespace-only changes.

test/fixtures/scp/local_path/backslash-a\ b.txt

Whitespace-only changes.

test/t/test_scp.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_basic(self, hosts, completion):
3333
)
3434
),
3535
# Local filenames
36-
["config", "known_hosts", "local_path/", r"spaced\ \ conf"],
36+
["config", "known_hosts", r"spaced\ \ conf"],
3737
)
3838
)
3939
assert completion == expected
@@ -53,7 +53,7 @@ def test_basic_spaced_conf(self, hosts, completion):
5353
)
5454
),
5555
# Local filenames
56-
["config", "known_hosts", "local_path/", r"spaced\ \ conf"],
56+
["config", "known_hosts", r"spaced\ \ conf"],
5757
)
5858
)
5959
assert completion == expected
@@ -247,8 +247,23 @@ def test_local_path_with_spaces_1(self, completion):
247247
def test_local_path_with_spaces_2(self, completion):
248248
assert completion == r"\ conf"
249249

250-
@pytest.mark.complete("scp backslash-a\\", cwd="scp/local_path")
251-
def test_local_path_backslash(self, completion):
250+
@pytest.fixture
251+
def tmpdir_backslash_2(self, request, bash):
252+
if sys.platform.startswith("win"):
253+
pytest.skip("Filenames not allowed on Windows")
254+
255+
tmpdir = prepare_fixture_dir(
256+
request,
257+
files=["backslash-a b.txt", r"backslash-a\ b.txt"],
258+
dirs=[],
259+
)
260+
return tmpdir
261+
262+
@pytest.mark.complete
263+
def test_local_path_backslash(self, bash, tmpdir_backslash_2):
264+
completion = assert_complete(
265+
bash, "scp backslash-a\\", cwd=tmpdir_backslash_2
266+
)
252267
assert completion == sorted(
253268
[r"backslash-a\ b.txt", r"backslash-a\\\ b.txt"]
254269
)

0 commit comments

Comments
 (0)