xonsh/tests/test_man.py

20 lines
593 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2015-06-17 22:58:05 +02:00
import os
2016-06-04 16:07:03 -04:00
import tempfile
2015-06-17 22:58:05 +02:00
import pytest
2015-06-17 22:58:05 +02:00
2016-05-28 22:12:21 -04:00
from xonsh.completers.man import complete_from_man
2015-06-17 22:58:05 +02:00
from tools import skip_if_on_windows
2015-08-02 16:14:56 -05:00
2015-06-17 22:58:05 +02:00
@skip_if_on_windows
def test_man_completion(monkeypatch, tmpdir, xonsh_builtins):
tempdir = tmpdir.mkdir('test_man')
monkeypatch.setitem(os.environ, 'MANPATH', os.path.dirname(os.path.abspath(__file__)))
xonsh_builtins.__xonsh_env__.update({'XONSH_DATA_DIR': str(tempdir)})
completions = complete_from_man('--', 'yes --', 4, 6, __xonsh_env__)
assert ('--version' in completions)
assert ('--help' in completions)