示例#1
0
文件: test_capi.py 项目: joar/cpython
        def target():
            idents = []

            def callback():
                idents.append(threading.get_ident())

            _testcapi._test_thread_state(callback)
            a = b = callback
            time.sleep(1)
            # Check our main thread is in the list exactly 3 times.
            self.assertEqual(idents.count(threading.get_ident()), 3, "Couldn't find main thread correctly in the list")
示例#2
0
    def TestThreadState():
        if support.verbose:
            print("auto-thread-state")

        idents = []

        def callback():
            idents.append(threading.get_ident())

        _testcapi._test_thread_state(callback)
        a = b = callback
        time.sleep(1)
        # Check our main thread is in the list exactly 3 times.
        if idents.count(threading.get_ident()) != 3:
            raise support.TestFailed("Couldn't find main thread correctly in the list")
def TestThreadState():
    import thread
    import time

    if test_support.verbose:
        print "auto-thread-state"

    idents = []

    def callback():
        idents.append(thread.get_ident())

    _testcapi._test_thread_state(callback)
    time.sleep(1)
    # Check our main thread is in the list exactly 3 times.
    if idents.count(thread.get_ident()) != 3:
        raise test_support.TestFailed, \
              "Couldn't find main thread correctly in the list"
示例#4
0
def TestThreadState():
    import thread
    import time

    if test_support.verbose:
        print "auto-thread-state"

    idents = []

    def callback():
        idents.append(thread.get_ident())

    _testcapi._test_thread_state(callback)
    time.sleep(1)
    # Check our main thread is in the list exactly 3 times.
    if idents.count(thread.get_ident()) != 3:
        raise test_support.TestFailed, \
              "Couldn't find main thread correctly in the list"