title: Python Unit Testing Failure
body: <p>I am trying to capture the output of the command "wahji -h". Save that output into the string op. I have a text file saved as wahjiHelp.txt that is the exact expected output of the command "wahji -h". I then try to read this file into the string who2. I then try to compare the two strings which should be exactly the same by using an assertion to try to make sure i am receiving the correct output from my command "wahji -h".I am new to python programming and programming in general. I am using python 2.7. Help would be much appreciated!!!</p>
  
  <p>When i run the test i get the following failure message: 
  I can see that there is a difference between the two strings it is comparing. When i run "wahji -h" in the terminal the output starts with 'usage: wahji.py [-h]'. For some reason when i capture that output from that command and save it to the string op it displays the output as 'usage: wahji [-h]'. It does not add the .py extension and I do not understand why when i use the subprocess to capture the output of the command, why the output is not exactly the same as the output when i actually type the same "wahji -h" command into the terminal.</p>
  
  <pre><code>FAIL: test_help (__main__.HelpTest)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
  File "test_wahji_help.py", line 30, in test_help
  self.assertEqual(op, who2)
  AssertionError: 'usage: wahji [-h] {init,remove,page,build,new} ...\n\noptional arguments:\n  -h, --help            show this help message and exit\n\nwahji commands:\n              The following are possible command line parameters for wahji\n\n  {init,remove,page,build,new}\n                        \n                        \twahji init --help\n                        \twahji remove --help\n                        \twahji page --help\n                        \twahji build --help\n                        \twahji new --help\n' != 'usage: wahji.py [-h] {init,remove,page,build,new} ...\n\noptional arguments:\n  -h, --help            show this help message and exit\n\nwahji commands:\n              The following are possible command line parameters for wahji\n\n  {init,remove,page,build,new}\n                        \n                        \twahji init --help\n                        \twahji remove --help\n                        \twahji page --help\n                        \twahji build --help\n                        \twahji new --help\n'
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>  1 import unittest
    2 import subprocess
    3 import filecmp
    4 import os
    5 import sys
    6 
    7 
    8 class HelpTest(unittest.TestCase):
    9 
   10         def test_help(self):   
   11 
   12                 op = subprocess.Popen(["wahji", "-h"], stdout=subprocess.PIPE).communicate()[0]
   13 
   14                 print op
   15 
   16                 opw = open( 'op1.txt', 'w' )
   17                 opw.write(op)
   18                 opw.close()
   19 
   20                 who = open('wahjiHelp.txt', 'r')
   21                 who2 = who.read()
   22                 who.close()
   23                 print who2
   24 
   25                 # print filecmp.cmp('op1.txt', 'wahjiHelp.txt', shallow = False)
   26 
   27                 op.strip()
   28                 who2.strip()
   29 
   30                 self.assertEqual(op, who2)
   31 
   32                 
   33 
   34 
   35 if __name__ == '__main__':
   36         unittest.main()
  </code></pre>