单元测试后的命令不执行

时间:2018-05-11 12:42:28

标签: python unit-testing execution

我在python 3.6中导入了unittest,并像这样使用它:

class TestFunc(unittest.TestCase):
        def test_half(self):
            pass
        def test_merge(self):
            pass
        def test_decrypt(self):
            pass
        def test_rank(self):
            pass

if __name__ == "__main__":
    print("printing before calling unittest")
    unittest.main()
    print("printing after calling unittest")

输出如下:

 printing before calling unittest
    ....
----------------------------------------------------------------------
Ran 4 tests in 0.001s

OK

Process finished with exit code 0

print的第二次调用,即print("printing after calling unittest"),不会执行。 为什么我在单元测试后无法做任何事情?如何在测试后继续使用代码?

0 个答案:

没有答案