[Python][mock][HowTo] 檢查 STDOUT 的輸出

如果某個 function/method 的責任是在 STDOUT 印出一些資訊(例如 xml.etree.ElementTree.dump()),要如何檢查輸出的資訊是正確的?



[Appium][Issue][1.2.2] iOS log capture failed: spawn ENOENT (deviceconsole)

Appium 1.2.2 一啟動 iOS 時會出現下面的錯誤:

info: [debug] Starting iOS device log capture via deviceconsole
error: iOS log capture failed: spawn ENOENT
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: spawn ENOENT
info: [debug] Error: spawn ENOENT
    at errnoException (child_process.js:1000:11)
    at Process.ChildProcess._handle.onexit (child_process.js:791:34)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: spawn ENOENT)","code":"ENOENT","errno":"ENOENT","syscall":"spawn","origValue":"spawn ENOENT"},"sessionId":null}
info: <-- POST /wd/hub/session 500 1780.745 ms - 197
info: [debug] Not setting device type since we're connected to a device
info: [debug] Getting bundle ID from app
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Creating iDevice object with udid 816008f7ad15fcdc53f97dec30ad6e543d186faa
info: [debug] Checking app install status using: /usr/local/lib/node_modules/appium/build/fruitstrap/fruitstrap isInstalled --id 816008f7ad15fcdc53f97dec30ad6e543d186faa --bundle tw.com.skysoft.iPhone

原因是 Appium 1.2.2 開始改用 deviceconsole (#3430),但 $APPIUM_HOME/build/deviceconsole 底下卻又找不到 deviceconsole 的關係。