Пример #1
0
        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")
Пример #3
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"
Пример #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"