Server IP : 85.214.239.14 / Your IP : 3.133.134.92 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /srv/modoboa/env/lib64/python3.5/site-packages/gevent/tests/ |
Upload File : |
from __future__ import print_function import os import unittest import gevent from gevent import core @unittest.skipUnless( getattr(core, 'LIBEV_EMBED', False), "Needs embedded libev. " "hub.loop.fileno is only defined when " "we embed libev for some reason. " "Choosing specific backends is also only supported by libev " "(not libuv), and besides, libuv has a nasty tendency to " "abort() the process if its FD gets closed. " ) class Test(unittest.TestCase): # NOTE that we extend unittest.TestCase, not greentest.TestCase # Extending the later causes the wrong hub to get used. assertRaisesRegex = getattr(unittest.TestCase, 'assertRaisesRegex', getattr(unittest.TestCase, 'assertRaisesRegexp')) def _check_backend(self, backend): hub = gevent.get_hub(backend, default=False) try: self.assertEqual(hub.loop.backend, backend) gevent.sleep(0.001) fileno = hub.loop.fileno() if fileno is None: raise unittest.SkipTest("backend %s lacks fileno" % (backend,)) os.close(fileno) with self.assertRaisesRegex(SystemError, "(libev)"): gevent.sleep(0.001) hub.destroy() self.assertIn('destroyed', repr(hub)) finally: if hub.loop is not None: hub.destroy() def _make_test(count, backend): # pylint:disable=no-self-argument def test(self): self._check_backend(backend) test.__name__ = 'test_' + backend + '_' + str(count) return test.__name__, test count = backend = None for count in range(2): for backend in core.supported_backends(): name, func = _make_test(count, backend) locals()[name] = func name = func = None del count del backend del _make_test if __name__ == '__main__': unittest.main()