title: How to get a single outcome from each python unit-test module
body: <p>I have different unit_test modules which are included by unit test codes as you'll see:</p>
  
  <pre class="lang-py prettyprint-override"><code>    import unittest
  
      class TestTest(unittest.TestCase):
          def setUp(self):
              pass
  
          def tearDown(self):
              pass
  
          def test_type(self):
              self.assertTrue(False)
  
      if __name__ == "__main__":
          unittest.main()
  </code></pre>
  
  <p>I need to get the result of each module after running it and write it in the database. So I expect 3 different outcomes after running each module:</p>
  
  <ul>
  <li>PASSED </li>
  <li>NOTPASSED</li>
  <li>WORKING</li>
  </ul>
  
  <p>But the problem is after running the test module I get such a output.</p>
  
  <blockquote>
    <p>F
        ======================================================================
        FAIL: test_test (<strong>main</strong>.TestTest)
        ----------------------------------------------------------------------
        Traceback (most recent call last):
          File "/Users/~/mytest.py", line 12, in test_test
            self.assertTrue(False)
        AssertionError: False is not true</p>
  </blockquote>
  
  <pre><code>----------------------------------------------------------------------
  Ran 1 test in 0.000s
  
  FAILED (failures=1)
  </code></pre>
  
  <p>I don't know if there is something in unittest to give me a straight value as I expect? </p>
  
  <p>I also tried this:</p>
  
  <pre class="lang-py prettyprint-override"><code>    TestTest = unittest.TestLoader().loadTestsFromTestCase(TestTest)
      suit = unittest.TestSuite([TestTest])
      result = unittest.TextTestRunner(verbosity=2).run(suit)
  
      print(result)
  </code></pre>
  
  <p>But it gives me this:</p>
  
  <blockquote>
    <p>test_test (<strong>main</strong>.TestTest) ... FAIL</p>
  </blockquote>
  
  <pre><code>======================================================================
  FAIL: test_test (__main__.TestTest)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/Users/~/mytest.py", line 12, in test_test
      self.assertTrue(False)
  AssertionError: False is not true
  
  ----------------------------------------------------------------------
  Ran 1 test in 0.000s
  
  FAILED (failures=1)
  </code></pre>