Beispiel #1
0
def test_is_main_thread():
    if sys.version_info[0] >= 3:
        # NB: the test itself doesn't necessarily run in main thread...
        is_main = (threading.current_thread() == threading.main_thread())
        assert util.is_main_thread() == is_main

    results = []

    def worker():
        results.append(util.is_main_thread())

    thread = threading.Thread(target=worker)
    thread.start()
    thread.join()

    assert results == [False]
Beispiel #2
0
def test_is_main_thread():
    if sys.version_info[0] >= 3:
        # NB: the test itself doesn't necessarily run in main thread...
        is_main = (threading.current_thread() == threading.main_thread())
        assert util.is_main_thread() == is_main

    results = []

    def worker():
        results.append(util.is_main_thread())

    thread = threading.Thread(target=worker)
    thread.start()
    thread.join()

    assert results == [False]
Beispiel #3
0
 def worker():
     results.append(util.is_main_thread())
Beispiel #4
0
 def worker():
     results.append(util.is_main_thread())