我使用pytest和@classmethod装饰器遇到了多个继承问题。我无法找出问题所在,可以寻求帮助。
import unittest
class HelperClass:
def __init__(self):
pass
def set_a_value(self):
self.x = 1
class TestSuite(unittest.TestCase, HelperClass):
@classmethod
def setUpClass(cls):
super(HelperClass, cls).__init__()
cls.set_a_value()
def test_something(self):
assert(self.x == 1)
TestSuite()
我得到的错误:
TypeError: descriptor '__init__' of 'object' object needs an argument