Skip to content

Commit b51c1c3

Browse files
committed
tests: fix equal_with_bash for .coverage files
Fixes #4162.
1 parent e14ca19 commit b51c1c3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

testing/test_argcomplete.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def equal_with_bash(prefix, ffc, fc, out=None):
1515
res_bash = set(fc(prefix))
1616
retval = set(res) == res_bash
1717
if out:
18-
out.write("equal_with_bash {} {}\n".format(retval, res))
18+
out.write("equal_with_bash({}) {} {}\n".format(prefix, retval, res))
1919
if not retval:
2020
out.write(" python - bash: %s\n" % (set(res) - res_bash))
2121
out.write(" bash - python: %s\n" % (res_bash - set(res)))
@@ -91,13 +91,19 @@ def __call__(self, prefix, **kwargs):
9191

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

9797
ffc = FastFilesCompleter()
9898
fc = FilesCompleter()
99-
for x in ["/", "/d", "/data", "qqq", ""]:
100-
assert equal_with_bash(x, ffc, fc, out=sys.stdout)
99+
100+
with tmpdir.as_cwd():
101+
assert equal_with_bash("", ffc, fc, out=sys.stdout)
102+
103+
tmpdir.ensure("data")
104+
105+
for x in ["d", "data", "doesnotexist", ""]:
106+
assert equal_with_bash(x, ffc, fc, out=sys.stdout)
101107

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

0 commit comments

Comments
 (0)