stem.util.proc testing
Stem's proc utilities [1] are currently completely untested. Precious little stem's core functionality currently relies on them, but arm and other stem users will likely find them to be useful for gathering basic information about the tor process (cpu/memory usage, uptime, etc) so we should strive to make them reliable.
For unit tests we'll want to mock out the os functions used by the proc module to stress both cases where it should succeed, and failure/edge cases. For an example of the mocking see stem.util.system's unit tests [2].
Integration tests should be easier. For those we simply need to exercise the proc functions against the tor process that we're running against. To get its pid run...
tor_pid = test.runner.get_runner().get_pid()
Each test should check stem.util.proc.is_available() and, if that's False, then skip the test since proc utilities are unavailable on that platform.
After the testing is in place we can made a long-awaited fix for the proc module (described in the bugs section of stem's wiki [3]).
Let me know if you run into any issues or have questions! Don't be shy to ask - it's far better for me to spend a few minutes answering a question that for you to bang your head against a wall for any length of time. :)
Cheers! -Damian
[1] http://www.atagar.com/transfer/tmp/stem_html_12_06_05/stem.util.html#module-stem.util.proc [2] https://gitweb.torproject.org/stem.git/blob/HEAD:/test/unit/util/system.py [3] https://trac.torproject.org/projects/tor/wiki/doc/stem#Bugs