title: How to unit test a function that uses Popen?
body: <p>I am writing a program which contains a lot of file operation. Some operations are done by calling  <code>subprocess.Popen</code>, eg, <code>split -l 50000 ${filename}</code>, <code>gzip -d -f ${filename} ${filename}.</code>.</p>
  
  <p>Now I want to unit test the functionality of the program. But how could I unit test these functions?</p>
  
  <p>Any suggestions?</p>