test_core.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:r2-d7 作者: FreakyDug 项目源码 文件源码
def test_threaded(testbot):
    def threadtest(signal):
        # If a new event loop isn't created for the thread, this will crash
        try:
            assert threading.current_thread() != threading.main_thread()
            testbot.load_data()
        except Exception as error:
            # Pytest will catch this stdout and print it and the signal will
            # fail the test
            print(error)
            signal.clear()
        else:
            signal.set()

    signal = threading.Event()
    thread = threading.Thread(target=threadtest, args=(signal, ))
    thread.start()
    thread.join()
    assert signal.is_set()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号