gpt4 book ai didi

python - Python 中的单元测试

转载 作者:行者123 更新时间:2023-11-28 20:33:38 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
ValueError: no such test method in <class 'myapp.tests.SessionTestCase'>: runTest

import unittest

class BzTestSe(unittest.TestCase):
DEFAULTUSERNAME = 'username-a2'
DEFAULTPASSWORD = 'pass'
DEFAULTHOST = 'localhots'

def __init__(self,username=DEFAULTUSERNAME, password=DEFAULTPASSWORD, host=DEFAULTHOST):
super(unittest.TestCase,self).__init__()
self.username=username
self.password=password
self.host=host

class test_se_topwebsite(BztTestSe):
def setUp(self):
print "setup"

def test_test_se_topwebsite(self):
self.fail()

当我从另一个文件调用上述类时,出现以下错误。请让我知道我哪里错了。

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "testsuite/test_se.py", line 10, in __init__
super(unittest.Testcase,self).__init__()
File "/usr/lib/python2.7/unittest/case.py", line 184, in __init__
(self.__class__, methodName))
ValueError: no such test method in <class 'testsuite.test_se.BztTestSe'>: runTest

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com