title: Python unittest - ValueError: no such test method in <class 'mytestcase.MyTestCase'>: runTest
body: <p>I have a very simple setup that uses unittest and I am getting an error that I don't understand.</p>
  
  <pre><code># mytestcase.py
  import unittest
  
  class MyTestCase(unittest.TestCase):
      def test_one(self):
          self.assertTrue(True)
      def test_two(self):
          self.assertTrue(False)
  
  
  def initialize():
      return MyTestCase()
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>
  
  <p>If I execute the above file, I get the following result, which I expect and understand:</p>
  
  <pre><code>&gt; python mytestcase.py
  .F
  ======================================================================
  FAIL: test_two (__main__.MyTestCase)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "mytestcase.py", line 7, in test_two
      self.assertTrue(False)
  AssertionError: False is not true
  
  ----------------------------------------------------------------------
  Ran 2 tests in 0.000s
  
  FAILED (failures=1)
  </code></pre>
  
  <p>But I want to run these tests another way, from <code>my_test_manager.py</code>:</p>
  
  <pre><code># my_test_manager.py
  import mytestcase
  
  test_case = mytestcase.initialize()
  test_suite = unittest.TestLoader().loadTestsFromTestCase(test_case)
  test_suite_result = unittest.TestResult()
  test_suite.run(test_suite_result)
  for err in test_suite_result.errors:
      print err
  for fail in test_suite_result.failures:
      print fail
  </code></pre>
  
  <p>But if I try to run this file, it crashes as follows:</p>
  
  <pre><code>&gt; python my_test_manager.py 
  Traceback (most recent call last):
    File "my_test_manager.py", line 3, in &lt;module&gt;
      test_case = mytestcase.initialize()
    File "/Users/Jon/dev/test-tools/practice/mytestcase.py", line 11, in initialize
      return MyTestCase()
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py", line 191, in __init__
      (self.__class__, methodName))
  ValueError: no such test method in &lt;class 'mytestcase.MyTestCase'&gt;: runTest
  </code></pre>