Best Python code snippet using autotest_python
os_dep_unittest.py
Source:os_dep_unittest.py
...371# @pytest.mark.skipif("os.stat(__file__).st_ino == 0", reason="requires valid inode and device numbers")372# def test_on_filesystem(tmpdir):373# ld_so_conf_dir = make_it(tmpdir)374# l = os_dep.Ldconfig()375# paths = list(l.ldconfig(376# str(ld_so_conf_dir.join("ld.so.conf")), extra_dirs=[]))377# print378# # for d in l.lddirs:379# # print d380# assert l.lddirs[0].path.endswith("lib3")381# assert l.lddirs[1].path.endswith("lib1")382# assert l.lddirs[1].flag == "glibc2"383# assert l.lddirs[2].path.endswith("lib2")384# assert l.lddirs[2].flag == "glibc2"385# assert paths[0].endswith("lib3")386# assert paths[1].endswith("lib1")387# assert paths[2].endswith("lib2")388#389#...
_clr_ldconfig_trigger.py
Source:_clr_ldconfig_trigger.py
1# -*- coding: utf-8 -*-2"""_clr_ldconfig_trigger command.3@author: Tobias Hunger <tobias.hunger@gmail.com>4"""5from cleanroom.binarymanager import Binaries6from cleanroom.command import Command7from cleanroom.helper.run import run8from cleanroom.location import Location9from cleanroom.systemcontext import SystemContext10import typing11import os12class ClrLdconfigTriggerCommand(Command):13 """The _clr_ldconfig_trigger command."""14 def __init__(self, **services: typing.Any) -> None:15 """Constructor."""16 super().__init__(17 "_clr_ldconfig_trigger",18 help_string="Update ldconfig caches.",19 file=__file__,20 **services,21 )22 def validate(23 self, location: Location, *args: typing.Any, **kwargs: typing.Any24 ) -> None:25 """Validate the arguments."""26 self._validate_no_arguments(location, *args, **kwargs)27 def __call__(28 self,29 location: Location,30 system_context: SystemContext,31 *args: typing.Any,32 **kwargs: typing.Any,33 ) -> None:34 """Execute command."""35 if not os.path.isfile(36 system_context.file_name("/usr/lib/systemd/system/ldconfig-trigger.service")37 ):38 return39 run(40 "/usr/bin/ldconfig",41 "-X",42 chroot_helper=self._binary(Binaries.SYSTEMD_NSPAWN),43 chroot=system_context.fs_directory,44 )45 if os.path.isfile(system_context.file_name("/usr/lib/tmpfiles.d/var.conf")):46 self._execute(47 location,48 system_context,49 "sed",50 "/\\/var\\/cache\\/ldconfig/ d",51 "/usr/lib/tmpfiles.d/var.conf",52 )53 self._execute(54 location,55 system_context,56 "sed",57 "/\\/var\\/cache\\/ldconfig/ d",58 "/usr/lib/tmpfiles.d/filesystem.conf",59 )60 self._execute(61 location,62 system_context,63 "persist_on_usr",64 "ldconfig-trigger",65 "/var/cache/ldconfig",66 )67 os.remove(68 system_context.file_name("/usr/lib/systemd/system/ldconfig-trigger.service")...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!