def test_compare_with_compgen(self): 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)
def test_remove_dir_prefix(self): """This is not compatible with compgen but it is with bash itself: ls /usr/<TAB>.""" from _pytest._argcomplete import FastFilesCompleter ffc = FastFilesCompleter() fc = FilesCompleter() for x in "/usr/".split(): assert not equal_with_bash(x, ffc, fc, out=sys.stdout)
def test_compare_with_compgen(self, tmpdir): from _pytest._argcomplete import FastFilesCompleter ffc = FastFilesCompleter() fc = FilesCompleter() 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)
def test_compare_with_compgen(self, tmp_path: Path, monkeypatch: MonkeyPatch) -> None: from _pytest._argcomplete import FastFilesCompleter ffc = FastFilesCompleter() fc = FilesCompleter() monkeypatch.chdir(tmp_path) assert equal_with_bash("", ffc, fc, out=sys.stdout) tmp_path.cwd().joinpath("data").touch() for x in ["d", "data", "doesnotexist", ""]: assert equal_with_bash(x, ffc, fc, out=sys.stdout)
def test_compare_with_compgen(self): from _pytest._argcomplete import FastFilesCompleter ffc = FastFilesCompleter() fc = FilesCompleter() for x in '/ /d /data qqq'.split(): assert equal_with_bash(x, ffc, fc, out=py.std.sys.stdout)
def test_compare_with_compgen(self): 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)