Best Python code snippet using autotest_python
setup.py
Source:setup.py  
...148    return True149# "squash" selected sub packages to a single package. Also removes150# setuptools dependency when tarballed.151def do_squash(name):152    if not _check_rsync():153        print("Squash requires rsync tool to be installed.")154        return False155    if not os.path.isdir(PYCOPIA_SQUASH):156        os.makedirs(PYCOPIA_SQUASH)157    os.chdir(name)158    uname = os.uname()159    bin_dir = os.path.join("build", "lib.%s-%s-%s" % (uname[0].lower(), uname[4], sys.version[:3]))160    # e.g: build/lib.linux-x86_64-2.5/pycopia161    print("======== SQUASH", name, "to", PYCOPIA_SQUASH)162    try:163        if WEXITSTATUS(os.system("%s setup.py build" % (sys.executable,))) != 0:164            return False165        for pydir in ("build/lib", bin_dir):166            if os.path.isdir(pydir):167                cmd = "rsync -azvu %s/ %s" % (pydir, PYCOPIA_SQUASH)168                if WEXITSTATUS(os.system(cmd)) != 0:169                    return False170    finally:171        os.chdir("..")172    _null_init(PYCOPIA_SQUASH)173    print("====================== END", name, "squashed into", PYCOPIA_SQUASH, "\n")174    return True175def _null_init(directory):176    open(os.path.join(directory, "pycopia", "__init__.py"), "w").close()177def _check_rsync():178    return WEXITSTATUS(os.system(RSYNCCHECK)) == 0179def do_generic(name):180    pass181def get_svn_revision():182    import subprocess183    from xml.etree import ElementTree184    info = ElementTree.fromstring(subprocess.check_output("svn info --xml".split()))185    rev = info.find("entry").attrib["revision"]186    return int(rev)187def main(argv):188    try:189        cmd = argv[1]190    except IndexError:191        print(DOC)...preflight.py
Source:preflight.py  
...30@returns_exception31def _check_git():32    _assert_executable_exists('git')33@returns_exception34def _check_rsync():35    _assert_executable_exists('rsync')36@returns_exception37def _check_virtualbox():38    _assert_executable_exists('VBoxManage')39@returns_exception40def _check_docker_machine():41    _assert_executable_exists('docker-machine')42@returns_exception43def _check_docker():44    _assert_executable_exists('docker')45@returns_exception46def _check_docker_compose():47    _assert_executable_exists('docker-compose')48@returns_exception...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!!
