Skip to content

Commit 929e7a6

Browse files
committed
tests: ignore .coverage files with equal_with_bash
Fixes #4162.
1 parent d4fdf79 commit 929e7a6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

testing/test_argcomplete.py

Lines changed: 7 additions & 3 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,14 +91,18 @@ 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, monkeypatch):
9595
from _pytest._argcomplete import FastFilesCompleter
9696

9797
ffc = FastFilesCompleter()
9898
fc = FilesCompleter()
99-
for x in ["/", "/d", "/data", "qqq", ""]:
99+
for x in ["/", "/d", "/data", "qqq"]:
100100
assert equal_with_bash(x, ffc, fc, out=sys.stdout)
101101

102+
# NOTE: do not use "" with cwd, since .coverage files might appear there.
103+
monkeypatch.chdir("/home")
104+
assert equal_with_bash("", ffc, fc, out=sys.stdout)
105+
102106
@pytest.mark.skipif("sys.platform in ('win32', 'darwin')")
103107
def test_remove_dir_prefix(self):
104108
"""this is not compatible with compgen but it is with bash itself:

0 commit comments

Comments
 (0)