title: How to fail a python unittest in setUpClass?
body: <p>I am doing some unittests with python and some pre-test checks in <code>setUpClass</code>. How can I throw a <code>unitest</code>-<code>fail</code> within the <code>setUpClass</code>, as the following simple example:</p>
  
  <pre><code>class MyTests(unittest.TestCase):
  
      @classmethod
      def setUpClass(cls):    
          unittest.TestCase.fail("Test")
  
      def test1(self):
          pass
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>
  
  <p>gives the error <code>TypeError: unbound method fail() must be called with TestCase instance as first argument (got str instance instead)</code>. </p>
  
  <p>I understand the error I get as fail is a instance method, and I don't have an instance of <code>MyClass</code> yet. Using an instance on-the-fly like</p>
  
  <pre><code>unittest.TestCase().fail("Test")
  </code></pre>
  
  <p>also does not work, as <code>unittest.TestCase</code> itself has no tests. Any ideas how to fail all tests in <code>MyClass</code>, when some condition in <code>setUpClass</code> is not met?</p>
  
  <p>Followup question: Is there a way to see the tests in <code>setUpClass</code>?</p>