|
| 1 | +import sys |
| 2 | + |
1 | 3 | import pytest
|
2 | 4 |
|
3 |
| -from conftest import assert_bash_exec, assert_complete |
| 5 | +from conftest import assert_bash_exec, assert_complete, prepare_fixture_dir |
4 | 6 |
|
5 | 7 |
|
6 |
| -@pytest.mark.bashcomp(ignore_env=r"^[+-]_comp_cmd_scp__path_esc=") |
| 8 | +@pytest.mark.bashcomp( |
| 9 | + ignore_env=r"^[+-]_comp_cmd_scp__path_esc=", temp_cwd=True |
| 10 | +) |
7 | 11 | class TestSshfs:
|
8 | 12 | @pytest.mark.complete("sshfs ./")
|
9 | 13 | def test_1(self, completion):
|
10 | 14 | assert completion
|
11 | 15 |
|
12 |
| - @pytest.mark.complete("sshfs local_path", cwd="sshfs") |
13 |
| - def test_local_path_suffix_1(self, completion): |
| 16 | + @pytest.fixture |
| 17 | + def tmpdir_backslash(self, request, bash): |
| 18 | + if sys.platform.startswith("win"): |
| 19 | + pytest.skip("Filenames not allowed on Windows") |
| 20 | + |
| 21 | + tmpdir, _, _ = prepare_fixture_dir( |
| 22 | + request, files=["local_path-file\\"], dirs=["local_path-dir"] |
| 23 | + ) |
| 24 | + return tmpdir |
| 25 | + |
| 26 | + def test_local_path_suffix_1(self, bash, tmpdir_backslash): |
| 27 | + completion = assert_complete( |
| 28 | + bash, "sshfs local_path", cwd=tmpdir_backslash |
| 29 | + ) |
| 30 | + |
14 | 31 | assert completion == "-dir/"
|
15 | 32 |
|
16 | 33 | def test_remote_path_ending_with_backslash(self, bash):
|
|
0 commit comments