Python testtools日志输出

时间:2019-01-12 12:05:44

标签: python multithreading selenium automated-tests

Hellom,我正在尝试使用teststools并行运行测试,这是我的跑步者代码

def split_suite_into_chunks(n, suite):
    # Keep n to a reasonable number of threads
    if n < 0:
        n = 1
    if n > 8:
        n = 8
    # Compute n such that the number of threads does not exceed the value passed to the function
    n = math.ceil(suite.countTestCases() / n)
    s = []
    i = 0
    s_tmp = unittest.TestSuite()
    for case in suite:
        if i < n:
            s_tmp.addTest(case)
            i += 1
        if i == n:
            s.append([s_tmp, None])
            i = 0
            s_tmp = unittest.TestSuite()
    if (i > 0):
        s.append([s_tmp, None])
    return s

def add_test_case_to_suite(suite, tc_name):
    # Creates a Test Suite with each Test Case added n times
    n = 1
    for i in range(0, n):
        suite.addTest(tc_name)

def get_suite():
    loader = TestLoader()
    suite = TestSuite((loader.loadTestsFromTestCase(StatusesCheckManual)))
    return suite

if __name__ == "__main__":
    # This is what sets the number of threads
    num_threads = 4
    suite = get_suite()
    concurrent_suite = testtools.ConcurrentStreamTestSuite(lambda: (split_suite_into_chunks(num_threads, suite)))
    concurrent_suite.run(testtools.StreamResult())

它工作正常,但除

之外,我没有任何日志
Process finished with exit code 0

即使有异常也不会显示。我如何启用它?

0 个答案:

没有答案