Python 在另一个TestClass中调用测试方法

Python 在另一个TestClass中调用测试方法,python,automation,webdriver,Python,Automation,Webdriver,嗨,我有以下的测试课程 logintests.py: class SignOnTests(BaseTest): def test_login_info(self): #some code passwordtests.py: class ResetPasswordTests(unittest.TestCase): def test_mytest(self): #somecode #Should Call SignOnTests.t

嗨,我有以下的测试课程 logintests.py:

 class SignOnTests(BaseTest): 
     def test_login_info(self):
        #some code
passwordtests.py:

class ResetPasswordTests(unittest.TestCase):
      def test_mytest(self):
      #somecode
      #Should Call SignOnTests.test_login_info()
我已尝试使用passwordtests.py: 从logintests导入SignOnTests 但是keep gettingTypeError:必须使用SignOnTests实例作为第一个参数调用未绑定的方法test\u login\u info()(而不是获取任何内容)


是否可以在另一个模块中调用测试方法?

是否尝试静态调用test\u login\u info()?比如你是在SignOnTests的实例上调用它,还是像SignOnTests一样调用它。test\u login\u info()我认为使用依赖于另一个unittest的unittest是一种不好的做法。不知道你为什么要叫它。看起来有一个设置正在进行中,您希望重用
test\u login\u info
,您可以查看unittest库是否有类似的内容,或者使用
setup
创建派生类。