def test_add_single_dir_adds(): ldconfig = os_dep.Ldconfig() a = os_dep.Ldconfig.DirEntry("a", "", 1, 2) b = os_dep.Ldconfig.DirEntry("b", "", 2, 3) ldconfig.lddirs = [a] ldconfig._add_single_dir(b) assert ldconfig.lddirs == [a, b]
def _test(parse_conf, glob_mock): ldconfig = os_dep.Ldconfig() ldconfig._parse_conf_include( os.path.join(os.sep, "etc", "ld.so.conf"), "foo", 1) assert glob_mock.call_args_list == [ call(os.path.join(os.path.join(os.sep, "etc"), "foo")) ]
def test_add_single_dir_reject_duplicates_not_same_path(): ldconfig = os_dep.Ldconfig() a = os_dep.Ldconfig.DirEntry("a", "", 1, 2) ldconfig.lddirs = [a] # rejects because ino and dev are the same ldconfig._add_single_dir(os_dep.Ldconfig.DirEntry("b", "", 1, 2)) assert ldconfig.lddirs == [a]
def _test(parse_conf, glob_mock): l = os_dep.Ldconfig() l._parse_conf_include(os.path.join(os.sep, "etc", "ld.so.conf"), os.path.join("a", "b", "c"), 1) assert glob_mock.call_args_list == [ call( os.path.join(os.path.join(os.sep, "etc"), os.path.join("a", "b", "c"))) ]
def _test(glob_mock): ldconfig = os_dep.Ldconfig() @patch.object(ldconfig, "parse_conf") def _test2(parse_conf_mock): ldconfig._parse_conf_include("noslash", "foo", 1) assert glob_mock.call_args_list == [call("foo")] # pylint: disable=E1120 _test2()
def _test(glob_mock): ldconfig = os_dep.Ldconfig() @patch.object(ldconfig, "parse_conf") def _test2(parse_conf_mock): ldconfig._parse_conf_include( os.path.join(os.sep, "etc", "ld.so.conf"), "foo", 1) assert glob_mock.call_args_list == [ call(os.path.join(os.sep, "etc", "foo")) ] assert parse_conf_mock.call_args_list == [ call("a", 2), call("b", 2), call("c", 2) ] # pylint: disable=E1120 _test2()
def test_read_config_file(): ldconfig = os_dep.Ldconfig() @patch.object(ldconfig, "_add_dir") @patch.object(ldconfig, "_parse_conf_include") def _test(parse_conf_include_mock, add_dir_mock): ldconfig._parse_config_line([ "include foo", " # comment", "", "hwcap 0 nosegneg", "asdf", "include *", "include glob1 glob2 glob3 \t \t \t glob4" ], "filename", 55) assert add_dir_mock.call_args_list == [call("asdf")] assert parse_conf_include_mock.call_args_list == [ call("filename", "foo", 55), call("filename", "*", 55), call("filename", "glob1", 55), call("filename", "glob2", 55), call("filename", "glob3", 55), call("filename", "glob4", 55), ] # pylint: disable=E1120 _test()
def _test(open_mock): ldconfig = os_dep.Ldconfig() ldconfig.parse_conf("") assert open_mock.called
def _test(open_mock): ldconfig = os_dep.Ldconfig() ldconfig.parse_conf("", ldconfig.MAX_RECURSION_DEPTH + 2) assert not open_mock.called
def _test(logging_mock, stat_mock): ldconfig = os_dep.Ldconfig() ldconfig._add_dir("asdf") assert ldconfig.lddirs == [] assert logging_mock.debug.called
def test_add_single_dir_reject_duplicates_same_path(): ldconfig = os_dep.Ldconfig() a = os_dep.Ldconfig.DirEntry("a", "", 1, 2) ldconfig.lddirs = [a] ldconfig._add_single_dir(a) assert ldconfig.lddirs == [a]