def build(self): os.chdir(ADB_JAR_AUBS) if os.name =='nt': result = run("gradlew.bat uiautomatorbuild") else: result = run("gradlew uiautomatorbuild") if result[0] == 0: L.info(result[1].replace("\n","")) else: L.warning(result[2].replace("\n","")) raise AndroidError("Android UiAutomator Binary for Stve Build Failed.")
def release(self): os.chdir(ADB_APK_AURA) if os.name =='nt': result = run("gradlew.bat assembleRelease") else: result = run("gradlew assembleRelease") if result[0] == 0: L.info(result[1].replace("\n","")) else: L.warning(result[2].replace("\n","")) raise AndroidError("Android Utility Re-cycle Application Build Failed.")
def create_video(self, src, dst, filename="output.mp4"): output = os.path.join(dst, filename) if os.path.exists(output): os.remove(output) cmd = r'%s -r 3 -i %s -an -vcodec libx264 -pix_fmt yuv420p %s' % ( FFMPEG_BIN, os.path.join( src, "image_%05d.png"), os.path.join(dst, filename)) L.debug(cmd) return run(cmd)
def __exec(self, cmd, timeout=TIMEOUT): L.debug(cmd) result = run(cmd, timeout=timeout) if result != None: try: if result[0] == 0: result = result[1].replace("\r", "") else: L.warning(result[2].replace("\r","")) raise AndroidError("Android Execute Failed.") except Exception as e: L.warning(str(e)) raise e return result
def test_cmd_run_sleep_timeout_02(): try: result = cmd.run("sleep 10", timeout=5) except TimeoutError as e: ok_(True)
def test_cmd_run_sleep_timeout_01(): result = cmd.run("sleep 10", timeout=5) eq_(result[0], 0)
def test_cmd_run_sleep_success(): result = cmd.run("sleep 2", timeout=5) eq_(result[0], 0)
def test_cmd_run_failed_02(): result = cmd.run("hoge") eq_(result[0], 1)
def test_cmd_run_failed_01(): result = cmd.run('ls -la | wc -l') eq_(result[0], 2)
def test_cmd_run_success_01(): result = cmd.run("ls") eq_(result[0], 0)