Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions testing/test_argcomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def equal_with_bash(prefix, ffc, fc, out=None):
res_bash = set(fc(prefix))
retval = set(res) == res_bash
if out:
out.write("equal_with_bash {} {}\n".format(retval, res))
out.write("equal_with_bash({}) {} {}\n".format(prefix, retval, res))
if not retval:
out.write(" python - bash: %s\n" % (set(res) - res_bash))
out.write(" bash - python: %s\n" % (res_bash - set(res)))
Expand Down Expand Up @@ -91,13 +91,19 @@ def __call__(self, prefix, **kwargs):

class TestArgComplete(object):
@pytest.mark.skipif("sys.platform in ('win32', 'darwin')")
def test_compare_with_compgen(self):
def test_compare_with_compgen(self, tmpdir):
from _pytest._argcomplete import FastFilesCompleter

ffc = FastFilesCompleter()
fc = FilesCompleter()
for x in ["/", "/d", "/data", "qqq", ""]:
assert equal_with_bash(x, ffc, fc, out=sys.stdout)

with tmpdir.as_cwd():
assert equal_with_bash("", ffc, fc, out=sys.stdout)

tmpdir.ensure("data")

for x in ["d", "data", "doesnotexist", ""]:
assert equal_with_bash(x, ffc, fc, out=sys.stdout)

@pytest.mark.skipif("sys.platform in ('win32', 'darwin')")
def test_remove_dir_prefix(self):
Expand Down