I am new to unittest
so I am not sure why I am getting this error:
Traceback (most recent call last):
File "filemerge_test.py", line 98, in <module>
main(sys.argv)
File "filemerge_test.py", line 92, in main
filemerge_test.test_runner()
File "filemerge_test.py", line 19, in test_runner
self.addTest(TestFunctionality(self.log, self.options))
File "/nfsdata/DSCluster/home/bli1/filemerge/tests/testcases.py", line 45, in __init__
super(TestFunctionality, self).__init__()
File "/usr/local/lib/python2.7/unittest/case.py", line 191, in __init__
(self.__class__, methodName))
ValueError: no such test method in <class 'testcases.TestFunctionality'>: runTest
Full code is here: http://ift.tt/1Rpwb7A
I think it is because I am not running the tests correctly.
Here is a summary of how my testing is currently written:
from testcases import TestFunctionality
class FileMergerTest(unittest.TestSuite)
def __init__(self, log, options):
super(FileMergerTest, self).__init__()
self.options = options
self.log = log
def test_runner(self):
self.addTest(TestFunctionality(self.log, self.options))
self.run()
def main()
...
...
filemerge_test = FileMergerTest(log, options)
filemerge_test.test_runner()
if __name__ == "__main__":
main(sys.argv)
In my testcases.py
where I imported TestFunctionality
class TestFunctionality(unittest.TestCase):
def __init__(self, log, options):
super(TestFunctionality, self).__init__()
self.options = options
self.log = log
...
def test_outputs(self, test_type)
...
...
def run(self):
self.test_outputs("-d")
self.test_outputs("-f")
I tried adding
if __name__ == '__main__':
unittest.main()
At the end of my testcases.py
file but I got the same error
Aucun commentaire:
Enregistrer un commentaire