如何将python测试与特定类关联,使用coverage.py进行代码覆盖?

时间:2014-08-14 02:48:56

标签: python code-coverage coverage.py python-coverage

我有以下文件:

hello.py:

class Say():
    def __init__(self):
        pass

    def hello(self):
        return "hello"

    def whatever(self, words):
        return words

test_say.py:

import unittest


class TestSay(unittest.TestCase):
    def test_hello(self):
        self.assertEqual(1, 1)

    def test_whatever(self):
        self.assertEqual(1, 1)


def main():
    unittest.main()


if __name__ == '__main__':
    main()

我跑的时候:

$ coverage.py hello.py

它没有显示与班级相关的测试。我错过了什么?

0 个答案:

没有答案