title: Python: mock patch class once for all test methods?
body: <p>Consider this example:</p>
  
  <p><strong>module.py:</strong></p>
  
  <pre><code>class LST:
      x = [1]
  
  
  class T:
      def __init__(self, times):
          self.times = times
  
      def t1(self):
          return LST.x * self.times
  
      def t2(self):
          return LST.x * (self.times+1)
  
      def t3(self):
          return LST.x * (self.times+2)
  </code></pre>
  
  <p><strong>test.py:</strong></p>
  
  <pre><code>from mock import patch
  
  import unittest
  import module
  
  
  @patch('module.LST')
  class TestM(unittest.TestCase):
  
      @classmethod
      def setUpClass(cls):
          super(TestM, cls).setUpClass()
          cls.t = module.T(1)
  
      def test_01(self, LST):
          LST.x = [2]
          self.assertEqual([2], self.t.t1())
  
      def test_02(self, LST):
          LST.x = [2]
          self.assertEqual([2, 2], self.t.t2())
  
      def test_03(self, LST):
          LST.x = [2]
          self.assertEqual([2, 2, 2], self.t.t3())
  </code></pre>
  
  <p>I want to modify <code>LST</code> class with patch only once, because that same modification would be used for all tests. </p>
  
  <p>Is it possible to modify it only once and then reuse it for all methods? So I would not need to repeat myself by doing <code>LST.x = [2]</code> on each method call?</p>