title: Call a python unittest from another script and export all the error messages
body: <p>Sorry for the basic question. I have used unittest method to check my models in one script. Now, my question is how do I call this script from another file and save testing results. Below is my code sample:</p>
  
  <pre><code>**model_test.py**
  
  import unittest
  import model_eq #script has models
  
  class modelOutputTest(unittest.TestCase):
      def setUp(self):
          #####Pre-defined inputs########
          self.dsed_in=[1,2]
  
          #####Pre-defined outputs########
          self.msed_out=[6,24]
  
          #####TestCase run variables########
          self.tot_iter=len(self.a_in)
  
      def testMsed(self):
          for i in range(self.tot_iter):
              fun = model_eq.msed(self.dsed_in[i],self.a_in[i],self.pb_in[i])
              value = self.msed_out[i]
              testFailureMessage = "Test of function name: %s iteration: %i expected: %i != calculated: %i" % ("msed",i,value,fun)
  self.assertEqual(round(fun,3),round(self.msed_out[i],3),testFailureMessage)
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>
  
  <p>The next step I want is to create another script called test_page.py, which runs the unit test script and save results to a variable (I need to post results to a webpage). </p>
  
  <pre><code>test_page.py    
  
  from model_test.py import *
  a=modelOutputTest.testMsed()
  </code></pre>
  
  <p>However, I got the following errors. </p>
  
  <pre><code>Traceback (most recent call last):
    File "D:\Dropbox\AppPest\rice\Rice_unittest.py", line 16, in &amp;lt;module&amp;gt;
      a= RiceOutputTest.testMsed()
  TypeError: unbound method testMsed() must be called with RiceOutputTest instance as first argument (got nothing instead)
  </code></pre>
  
  <p>Can anyone give me some suggestions? Thanks!</p>
  
  <p>Thanks for the help from Nix! My next question is: I need to test the function with two given cases in a loop. It is posted <a href="https://stackoverflow.com/questions/14285010/python-unit-testing-a-loop-function">here</a>.</p>