新手区 求教,python 中值的传递,麻烦各位大佬帮忙看下,程序入口的 ‘’ i ‘’ 值怎样传回我的类里面。

明ing · 2018年04月17日 · 最后由 明ing 回复于 2018年04月17日 · 4583 次阅读

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()

共收到 2 条回复 时间 点赞

不明觉厉,i 不是你在创建进程时传过去的吗?代码格式排版不好

已经,解决,谢谢。

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册