Python test.support.threading_cleanup() Examples

The following are 30 code examples of test.support.threading_cleanup(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module test.support , or try the search function .
Example #1
Source File: test_thread.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def setUp(self):
        self.done_mutex = thread.allocate_lock()
        self.done_mutex.acquire()
        self.running_mutex = thread.allocate_lock()
        self.random_mutex = thread.allocate_lock()
        self.created = 0
        self.running = 0
        self.next_ident = 0

        key = support.threading_setup()
        self.addCleanup(support.threading_cleanup, *key) 
Example #2
Source File: test_thread.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def setUp(self):
        self.done_mutex = thread.allocate_lock()
        self.done_mutex.acquire()
        self.running_mutex = thread.allocate_lock()
        self.random_mutex = thread.allocate_lock()
        self.created = 0
        self.running = 0
        self.next_ident = 0

        key = support.threading_setup()
        self.addCleanup(support.threading_cleanup, *key) 
Example #3
Source File: test_docxmlrpc.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        self.client.close()

        self.evt.wait()

        # Disable server feedback
        DocXMLRPCServer._send_traceback_header = False
        support.threading_cleanup(*self._threads) 
Example #4
Source File: test_asynchat.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        support.threading_cleanup(*self._threads) 
Example #5
Source File: test_utils.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def tearDown(self):
        self.unpatch_get_running_loop()

        events.set_event_loop(None)

        # Detect CPython bug #23353: ensure that yield/yield-from is not used
        # in an except block of a generator
        self.assertEqual(sys.exc_info(), (None, None, None))

        self.doCleanups()
        support.threading_cleanup(*self._thread_cleanup)
        support.reap_children() 
Example #6
Source File: test_ftplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_main():
    tests = [TestFTPClass, TestTimeouts,
             TestIPv6Environment,
             TestTLS_FTPClassMixin, TestTLS_FTPClass]

    thread_info = support.threading_setup()
    try:
        support.run_unittest(*tests)
    finally:
        support.threading_cleanup(*thread_info) 
Example #7
Source File: test_urllib2_localnet.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def tearDownModule():
    if threads_key:
        support.threading_cleanup(threads_key) 
Example #8
Source File: lock_tests.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def tearDown(self):
        support.threading_cleanup(*self._threads)
        support.reap_children() 
Example #9
Source File: test_httpservers.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def tearDown(self):
        self.thread.stop()
        self.thread = None
        os.environ.__exit__()
        support.threading_cleanup(*self._threads) 
Example #10
Source File: test_poplib.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_main():
    tests = [TestPOP3Class, TestTimeouts,
             TestPOP3_SSLClass, TestPOP3_TLSClass]
    thread_info = test_support.threading_setup()
    try:
        test_support.run_unittest(*tests)
    finally:
        test_support.threading_cleanup(*thread_info) 
Example #11
Source File: test_poplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_main():
    tests = [TestPOP3Class, TestTimeouts,
             TestPOP3_SSLClass, TestPOP3_TLSClass]
    thread_info = test_support.threading_setup()
    try:
        test_support.run_unittest(*tests)
    finally:
        test_support.threading_cleanup(*thread_info) 
Example #12
Source File: test_os.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def tearDownClass(cls):
        support.threading_cleanup(*cls.key)
        support.unlink(support.TESTFN) 
Example #13
Source File: test_asynchat.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def tearDown(self):
        support.threading_cleanup(*self._threads) 
Example #14
Source File: test_ftplib.py    From android_universal with MIT License 5 votes vote down vote up
def test_main():
    tests = [TestFTPClass, TestTimeouts,
             TestIPv6Environment,
             TestTLS_FTPClassMixin, TestTLS_FTPClass,
             MiscTestCase]

    thread_info = support.threading_setup()
    try:
        support.run_unittest(*tests)
    finally:
        support.threading_cleanup(*thread_info) 
Example #15
Source File: test_urllib2_localnet.py    From android_universal with MIT License 5 votes vote down vote up
def tearDownModule():
    if threads_key:
        support.threading_cleanup(*threads_key) 
Example #16
Source File: lock_tests.py    From android_universal with MIT License 5 votes vote down vote up
def tearDown(self):
        support.threading_cleanup(*self._threads)
        support.reap_children() 
Example #17
Source File: utils.py    From android_universal with MIT License 5 votes vote down vote up
def tearDown(self):
        self.unpatch_get_running_loop()

        events.set_event_loop(None)

        # Detect CPython bug #23353: ensure that yield/yield-from is not used
        # in an except block of a generator
        self.assertEqual(sys.exc_info(), (None, None, None))

        self.doCleanups()
        support.threading_cleanup(*self._thread_cleanup)
        support.reap_children() 
Example #18
Source File: test_os.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def tearDownClass(cls):
        support.threading_cleanup(*cls.key)
        support.unlink(support.TESTFN) 
Example #19
Source File: fork_wait.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        # Stop threads
        self.stop = 1
        for thread in self.threads:
            thread.join()
        thread = None
        del self.threads[:]
        support.threading_cleanup(*self._threading_key) 
Example #20
Source File: test_ftplib.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_main():
    tests = [TestFTPClass, TestTimeouts,
             TestIPv6Environment,
             TestTLS_FTPClassMixin, TestTLS_FTPClass]

    thread_info = support.threading_setup()
    try:
        support.run_unittest(*tests)
    finally:
        support.threading_cleanup(*thread_info) 
Example #21
Source File: test_urllib2_localnet.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def tearDownModule():
    if threads_key:
        support.threading_cleanup(threads_key) 
Example #22
Source File: lock_tests.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def tearDown(self):
        support.threading_cleanup(*self._threads)
        support.reap_children() 
Example #23
Source File: test_poplib.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_main():
    tests = [TestPOP3Class, TestTimeouts,
             TestPOP3_SSLClass, TestPOP3_TLSClass]
    thread_info = test_support.threading_setup()
    try:
        test_support.run_unittest(*tests)
    finally:
        test_support.threading_cleanup(*thread_info) 
Example #24
Source File: test_docxmlrpc.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def tearDown(self):
        self.client.close()

        self.evt.wait()

        # Disable server feedback
        DocXMLRPCServer._send_traceback_header = False
        support.threading_cleanup(*self._threads) 
Example #25
Source File: test_asynchat.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def tearDown(self):
        support.threading_cleanup(*self._threads) 
Example #26
Source File: _asyncio_test_utils.py    From txaio with MIT License 5 votes vote down vote up
def tearDown(self):
        self.unpatch_get_running_loop()

        events.set_event_loop(None)

        # Detect CPython bug #23353: ensure that yield/yield-from is not used
        # in an except block of a generator
        self.assertEqual(sys.exc_info(), (None, None, None))

        self.doCleanups()
        support.threading_cleanup(*self._thread_cleanup)
        support.reap_children() 
Example #27
Source File: test_ftplib.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_main():
    tests = [TestFTPClass, TestTimeouts, TestNetrcDeprecation,
             TestIPv6Environment,
             TestTLS_FTPClassMixin, TestTLS_FTPClass]

    thread_info = support.threading_setup()
    try:
        support.run_unittest(*tests)
    finally:
        support.threading_cleanup(*thread_info) 
Example #28
Source File: test_urllib2_localnet.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def tearDownModule():
    if threads_key:
        support.threading_cleanup(threads_key) 
Example #29
Source File: lock_tests.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        support.threading_cleanup(*self._threads)
        support.reap_children() 
Example #30
Source File: test_ssl.py    From ironpython3 with Apache License 2.0 4 votes vote down vote up
def test_main(verbose=False):
    if support.verbose:
        plats = {
            'Linux': platform.linux_distribution,
            'Mac': platform.mac_ver,
            'Windows': platform.win32_ver,
        }
        for name, func in plats.items():
            plat = func()
            if plat and plat[0]:
                plat = '%s %r' % (name, plat)
                break
        else:
            plat = repr(platform.platform())
        print("test_ssl: testing with %r %r" %
            (ssl.OPENSSL_VERSION, ssl.OPENSSL_VERSION_INFO))
        print("          under %s" % plat)
        print("          HAS_SNI = %r" % ssl.HAS_SNI)
        print("          OP_ALL = 0x%8x" % ssl.OP_ALL)
        try:
            print("          OP_NO_TLSv1_1 = 0x%8x" % ssl.OP_NO_TLSv1_1)
        except AttributeError:
            pass

    for filename in [
        CERTFILE, REMOTE_ROOT_CERT, BYTES_CERTFILE,
        ONLYCERT, ONLYKEY, BYTES_ONLYCERT, BYTES_ONLYKEY,
        SIGNED_CERTFILE, SIGNED_CERTFILE2, SIGNING_CA,
        BADCERT, BADKEY, EMPTYCERT]:
        if not os.path.exists(filename):
            raise support.TestFailed("Can't read certificate file %r" % filename)

    tests = [ContextTests, BasicSocketTests, SSLErrorTests]

    if support.is_resource_enabled('network'):
        tests.append(NetworkedTests)

    if _have_threads:
        thread_info = support.threading_setup()
        if thread_info:
            tests.append(ThreadedTests)

    try:
        support.run_unittest(*tests)
    finally:
        if _have_threads:
            support.threading_cleanup(*thread_info)