/
opt
/
imh-python
/
lib
/
python3.9
/
site-packages
/
tornado
/
test
/
/opt/imh-python/lib/python3.9/site-packages/tornado/test
mkdir
upload
Name
Size
Mode
Actions
csv_translations/
-
0755
rm
gettext_translations/
-
0755
rm
static/
-
0755
rm
templates/
-
0755
rm
__pycache__/
-
0755
rm
asyncio_test.py
7329
0644
edit
dl
rm
auth_test.py
24026
0644
edit
dl
rm
autoreload_test.py
4075
0644
edit
dl
rm
concurrent_test.py
6174
0644
edit
dl
rm
curl_httpclient_test.py
4477
0644
edit
dl
rm
escape_test.py
12694
0644
edit
dl
rm
gen_test.py
34721
0644
edit
dl
rm
http1connection_test.py
1972
0644
edit
dl
rm
httpclient_test.py
32067
0644
edit
dl
rm
httpserver_test.py
46332
0644
edit
dl
rm
httputil_test.py
19600
0644
edit
dl
rm
import_test.py
2046
0644
edit
dl
rm
ioloop_test.py
26060
0644
edit
dl
rm
iostream_test.py
46178
0644
edit
dl
rm
locale_test.py
5907
0644
edit
dl
rm
locks_test.py
17564
0644
edit
dl
rm
log_test.py
9778
0644
edit
dl
rm
netutil_test.py
8047
0644
edit
dl
rm
options_test.cfg
76
0644
edit
dl
rm
options_test.py
12174
0644
edit
dl
rm
options_test_types.cfg
277
0644
edit
dl
rm
options_test_types_str.cfg
158
0644
edit
dl
rm
process_test.py
11392
0644
edit
dl
rm
queues_test.py
14188
0644
edit
dl
rm
resolve_test_helper.py
421
0644
edit
dl
rm
routing_test.py
9121
0644
edit
dl
rm
runtests.py
8440
0644
edit
dl
rm
simple_httpclient_test.py
31821
0644
edit
dl
rm
static_foo.txt
97
0644
edit
dl
rm
tcpclient_test.py
17115
0644
edit
dl
rm
tcpserver_test.py
6674
0644
edit
dl
rm
template_test.py
19204
0644
edit
dl
rm
test.crt
1244
0644
edit
dl
rm
test.key
1732
0644
edit
dl
rm
testing_test.py
10985
0644
edit
dl
rm
twisted_test.py
8116
0644
edit
dl
rm
util.py
3768
0644
edit
dl
rm
util_test.py
10127
0644
edit
dl
rm
websocket_test.py
28331
0644
edit
dl
rm
web_test.py
118423
0644
edit
dl
rm
windows_test.py
698
0644
edit
dl
rm
wsgi_test.py
677
0644
edit
dl
rm
__init__.py
398
0644
edit
dl
rm
__main__.py
347
0644
edit
dl
rm
Edit:
/opt/imh-python/lib/python3.9/site-packages/tornado/test/autoreload_test.py
(4075B)
import os import shutil import subprocess from subprocess import Popen import sys from tempfile import mkdtemp import time import unittest class AutoreloadTest(unittest.TestCase): def setUp(self): self.path = mkdtemp() def tearDown(self): try: shutil.rmtree(self.path) except OSError: # Windows disallows deleting files that are in use by # another process, and even though we've waited for our # child process below, it appears that its lock on these # files is not guaranteed to be released by this point. # Sleep and try again (once). time.sleep(1) shutil.rmtree(self.path) def test_reload_module(self): main = """\ import os import sys from tornado import autoreload # This import will fail if path is not set up correctly import testapp print('Starting') if 'TESTAPP_STARTED' not in os.environ: os.environ['TESTAPP_STARTED'] = '1' sys.stdout.flush() autoreload._reload() """ # Create temporary test application os.mkdir(os.path.join(self.path, "testapp")) open(os.path.join(self.path, "testapp/__init__.py"), "w").close() with open(os.path.join(self.path, "testapp/__main__.py"), "w") as f: f.write(main) # Make sure the tornado module under test is available to the test # application pythonpath = os.getcwd() if "PYTHONPATH" in os.environ: pythonpath += os.pathsep + os.environ["PYTHONPATH"] p = Popen( [sys.executable, "-m", "testapp"], stdout=subprocess.PIPE, cwd=self.path, env=dict(os.environ, PYTHONPATH=pythonpath), universal_newlines=True, ) out = p.communicate()[0] self.assertEqual(out, "Starting\nStarting\n") def test_reload_wrapper_preservation(self): # This test verifies that when `python -m tornado.autoreload` # is used on an application that also has an internal # autoreload, the reload wrapper is preserved on restart. main = """\ import os import sys # This import will fail if path is not set up correctly import testapp if 'tornado.autoreload' not in sys.modules: raise Exception('started without autoreload wrapper') import tornado.autoreload print('Starting') sys.stdout.flush() if 'TESTAPP_STARTED' not in os.environ: os.environ['TESTAPP_STARTED'] = '1' # Simulate an internal autoreload (one not caused # by the wrapper). tornado.autoreload._reload() else: # Exit directly so autoreload doesn't catch it. os._exit(0) """ # Create temporary test application os.mkdir(os.path.join(self.path, "testapp")) init_file = os.path.join(self.path, "testapp", "__init__.py") open(init_file, "w").close() main_file = os.path.join(self.path, "testapp", "__main__.py") with open(main_file, "w") as f: f.write(main) # Make sure the tornado module under test is available to the test # application pythonpath = os.getcwd() if "PYTHONPATH" in os.environ: pythonpath += os.pathsep + os.environ["PYTHONPATH"] autoreload_proc = Popen( [sys.executable, "-m", "tornado.autoreload", "-m", "testapp"], stdout=subprocess.PIPE, cwd=self.path, env=dict(os.environ, PYTHONPATH=pythonpath), universal_newlines=True, ) # This timeout needs to be fairly generous for pypy due to jit # warmup costs. for i in range(40): if autoreload_proc.poll() is not None: break time.sleep(0.1) else: autoreload_proc.kill() raise Exception("subprocess failed to terminate") out = autoreload_proc.communicate()[0] self.assertEqual(out, "Starting\n" * 2)
Save
cmd:
run