/
githubmirror
/
bash-completion
Обзор
Документация
Войти
/
githubmirror
/
bash-completion
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/t/test_ip.py
93 строки
3 KB
Koichi Murase
test(runLint): adjust harmless codes
02 апр 2026, 23:08
02 апр 2026, 23:08
1309562
Код
Авторство
О чём код?
import os import pytest class TestIp: @pytest.fixture(scope="class") def iproute2_conf(self): if not any( os.path.isdir(path) for path in ( "/usr/share/iproute2", "/usr/lib/iproute2", "/etc/iproute2", ) ): pytest.skip("No iproute2 configuration") @pytest.mark.complete("ip ") def test_1(self, completion): assert completion @pytest.mark.complete("ip a ") def test_2(self, completion): assert completion @pytest.mark.complete("ip route replace ", require_cmd=True) def test_r_r(self, completion): assert completion @pytest.mark.complete( "ip stats show group ", require_cmd=True, skipif="ip stats help 2>/dev/null; (( $? != 255 ))", ) def test_stats(self, completion): # "link" was one of the first groups added, should always be there assert "link" in completion @pytest.mark.complete( "ip neigh show nud ", require_cmd=True, skipif="ip neigh help 2>&1 | command grep 'STATE :=' > /dev/null; (( $? != 0 ))", ) def test_neigh_state(self, completion): assert "stale" in completion @pytest.mark.complete( "ip neig", require_cmd=True, skipif="ip neighbor help 2>/dev/null; (( $? != 255 ))", ) def test_neigh_one_completion(self, completion): assert len(completion) == 1 @pytest.mark.complete( "ip monitor ", require_cmd=True, skipif="ip monitor help 2>/dev/null; (( $? != 255 ))", ) def test_monitor(self, completion): assert "neigh" in completion assert "all" in completion @pytest.mark.complete("ip netconf ") def test_netconf(self, completion): assert "show" in completion @pytest.mark.complete("ip link property add ") def test_link_property(self, completion): assert "altname" in completion assert "dev" in completion @pytest.mark.complete( "ip addr show type ", require_cmd=True, skipif="ip link help 2>/dev/null; (( $? != 255 ))", ) def test_addr_type(self, completion): assert "bridge" in completion @pytest.mark.complete("ip -", require_cmd=True) def test_options(self, completion): assert "-family" in completion @pytest.mark.complete("ip link show group ", require_cmd=True) def test_link_groups_from_file(self, completion, iproute2_conf): assert "default" in completion @pytest.mark.complete("ip addr show scope ", require_cmd=True) def test_addr_scopes_from_file(self, completion, iproute2_conf): assert "host" in completion assert "global" in completion