When using Python's built-in unittest, there are at least 2 different ways to organize class-level settings, using setUpClass()
or just use old-school class member. When to use one, and when another?
class TestFoo(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.foo = Foo(...)
def test_blah(self):
self.foo.do_something()
...
VS
class TestFoo(unittest.TestCase):
foo = Foo(...)
def test_blah(self):
self.foo.do_something()
...