Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.129.70.162
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /srv/modoboa/env/lib64/python3.5/site-packages/gevent/tests//test__monkey_scope.py
import os
import os.path
import sys

import unittest

from subprocess import Popen
from subprocess import PIPE

class TestRun(unittest.TestCase):
    maxDiff = None

    def setUp(self):
        self.cwd = os.getcwd()
        os.chdir(os.path.dirname(__file__))

    def tearDown(self):
        os.chdir(self.cwd)

    def _run(self, script):
        env = os.environ.copy()
        env['PYTHONWARNINGS'] = 'ignore'
        args = [sys.executable, '-m', 'gevent.monkey', script, 'patched']
        p = Popen(args, stdout=PIPE, stderr=PIPE, env=env)
        gout, gerr = p.communicate()
        self.assertEqual(0, p.returncode, (gout, gerr))

        args = [sys.executable, script, 'stdlib']
        p = Popen(args, stdout=PIPE, stderr=PIPE)

        pout, perr = p.communicate()
        self.assertEqual(0, p.returncode, (pout, perr))

        glines = gout.decode("utf-8").splitlines()
        plines = pout.decode('utf-8').splitlines()
        self.assertEqual(glines, plines)
        self.assertEqual(gerr, perr)

        return glines, gerr

    def test_run_simple(self):
        self._run(os.path.join('monkey_package', 'script.py'))

    def test_run_package(self):
        # Run a __main__ inside a package.
        lines, _ = self._run('monkey_package')

        self.assertTrue(lines[0].endswith('__main__.py'), lines[0])
        self.assertEqual(lines[1], '__main__')

    def test_issue_302(self):
        lines, _ = self._run(os.path.join('monkey_package', 'issue302monkey.py'))

        self.assertEqual(lines[0], 'True')
        lines[1] = lines[1].replace('\\', '/') # windows path
        self.assertEqual(lines[1], 'monkey_package/issue302monkey.py')
        self.assertEqual(lines[2], 'True', lines)


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

Anon7 - 2022
AnonSec Team