99% of this CL is simply moving calls to "import pexpect" to a more narrow scope - i.e. the function that actually runs a particular test. This way the test suite can run on Windows, which doesn't have pexpect, and the individual tests that use pexpect can be disabled on a platform-specific basis.
There were a handful of other changes that address other portability issues. Notably, using "ps" to get the command line (changed to use ' '.join(sys.argv)), and using os.uname() which isn't on Windows.