简体   繁体   中英

Dangers of running Appium as a python subprocess?

I'm using Appium for UI testing, and Robot Framework above that. I'm trying to automate all of the servers and services necessary to test an iOS app, including the Appium server. This seems to be causing some breakage inside Appium. In particular, we seem so get stuck when calling driver.get_elements_by_accessibility_id(id)

The subprocess kick-off looks like this:

self.app = subprocess.Popen("appium", shell=True, stdout=PIPE, stderr=PIPE)

When we drop the stdout/stderr kwargs, or make them point at files, the behavior returns to normal. Is there some dependence on stdout/stderr that causes this?

Don't use PIPE unless you read from the pipes eg, using out, err = self.app.communicate() . Otherwise, the child process may hang that is why subprocess.call() docs warn :

Do not use stdout=PIPE or stderr=PIPE with this function. The child process will block if it generates enough output to a pipe to fill up the OS pipe buffer as the pipes are not being read from.

subprocess.call() does not consume the pipes and therefore you should not pass PIPE to it. To discard output, you could use DEVNULL instead . The same applies to Popen() if you don't use self.app.stdout/stderr later.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM