def __generateTestCase():
csvfile = file("login_table.csv","rb")
numbers = csv.reader(csvfile)
a = 0 for i in numbers: if a == 0:
a = 1 continue setattr(Login,'test_func_%s' % (i[0].decode("gbk").encode("utf-8")),
Login.getTestFunc(*i))
testunit.addTest(unittest.makeSuite(Login))
runner.run(testunit)
错误信息:
D:\python\python.exe E:/codings/yntest/login_1.py
FETraceback (most recent call last):
File "E:/codings/yntest/login_1.py", line 67, in <module>
runner.run(testunit)
File "D:\python\lib\HTMLTestRunner.py", line 630, in run
self.generateReport(test, result)
File "D:\python\lib\HTMLTestRunner.py", line 677, in generateReport
report = self._generate_report(result)
File "D:\python\lib\HTMLTestRunner.py", line 741, in _generate_report
self._generate_report_test(rows, cid, tid, n, t, o, e)
File "D:\python\lib\HTMLTestRunner.py", line 787, in _generate_report_test
status = self.STATUS[n],
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 87: ordinal not in range(128)