avocado-framework/avocado — pull request #252 by lmr (2014-11-11 14:17:00+00:00)
Title: [V5] Process init on demand

Follow up to PR #251.

Move SubProcess() internal subprocess initialization to a separate method, and don't execute it at init time. Add a new .start() method, for people wanting to use background processes, such as QEMU instances inside a virt related test.

With this, we honor the user's expectation for the run() method - start a process and wait until it ends. Also, it requires a minimal change in the virt plugin (calling the .start() method in the QEMU SubProcess() call).

Changelog:
lmr@process_init_on_demand_v4...process_init_on_demand_v5

v4 -> v5:

Implemented suggestions by @ruda
* turned attributes `.sp` into `._popen`,
* turned method method `._init_sp` into `._init_subprocess`,
* added __repr__
* added public method stop() for symmetry

v3 -> v4:

Added shell param to process APIs, since that was the solution to the functional tests being stuck on the Travis CI VM.

v2 -> v3:

Added functional tests (adapted from original code made by @ruda).

v1 -> v2: Addressed comments by @ruda:

Added .start() method docstring
Made .start() to return the subprocess PID