Best Python code snippet using localstack_python
run.py
Source:run.py
...145 child.kill()146 except Exception:147 pass148 parent.kill()149def wait_for_process_to_be_killed(pid: int, sleep: float = None, retries: int = None):150 import psutil151 def _check_pid():152 assert not psutil.pid_exists(pid)153 retry(_check_pid, sleep=sleep, retries=retries)154def is_root() -> bool:155 return get_os_user() == "root"156@lru_cache()157def get_os_user() -> str:158 # using getpass.getuser() seems to be reporting a different/invalid user in Docker/MacOS159 return run("whoami").strip()160def to_str(obj: Union[str, bytes], errors="strict"):161 return obj.decode(config.DEFAULT_ENCODING, errors) if isinstance(obj, bytes) else obj162class ShellCommandThread(FuncThread):163 """Helper class to run a shell command in a background thread."""...
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!!