import unittest
import multiprocessing

class PearMain(unittest.TestCase):
def init(self,methodName='runTest',parame=None):
super(PearMain,self).init(methodName)
global parames
parames = parame

class LoginPage(PearMain):

@classmethod
def setUpClass(cls):
"""
打开 server
:return:
"""
print('eqweqeqwe', parames)

@classmethod
def tearDownClass(cls):
"""
结束操作
:return:
"""

def test_01(self):
"""
logincase
:return:
"""
print('this is',parames)

def get_suite(i):
suite = unittest.TestSuite()
suite.addTest(LoginPage("test_01", parame=i))
print(i,'get_suite')

if name == 'main':
threads = []
for i in range(3):
t = multiprocessing.Process(target=get_suite,args=(i,))
threads.append(t)
for j in threads:
j.start()


↙↙↙阅读原文可查看相关链接,并与作者交流