Python Unittest- class variables
<p>I was hoping someone wouldn't mind explaining what is going on here. I am attempting to run a python unittest that has been confirmed to be working using python 2.7. However, when attempting to run this same test on a machine running python 2.6 I am getting an error which I cannot figure out. Here is an example of what is happening</p>

<pre><code>import re, string, os, subprocess, unittest
import MERCH_FUNCTIONS


class merchTests(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self._merchFileString=open("test_file.txt",'r').read()
        self._merchFileList=self._merchFileString.split("\n") #convert string to list

    def test_stuff(self):
         #print list
         print(self._merchFileList) 
if __name__ == '__main__':
    unittest.main()
</code></pre>

<p>For some reason if I run this code using python 2.7 it successfully runs the test, and the list self._merchFileList prints out.</p>

<p>However, when running this same code with python 2.6 I am getting the following error(s):</p>

<pre><code>======================================================================
ERROR: test_stuff (__main__.merchTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "MERCH_Test_Case.py", line 14, in test_stuff
    print(self._merchFileList)
AttributeError: 'merchTests' object has no attribute '_merchFileList'

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
</code></pre>

<p>I cannot for the life of me figure out what is going on here. I have tried several different things with no success. If someone would be so kind as to explain what is going wrong here I would greatly appreciate it.</p>

<p>Thank you in advance.</p>