U
    luf                     @   s6   d dl Z d dlZd dlZdZdZG dd dejZdS )    Nss  
# The event loop is not fork-safe, and it's easy to initialize an asyncio.Future
# at startup, which in turn creates the default event loop and prevents forking.
# Explicitly disallow the default event loop so that an error will be raised
# if something tries to touch it.
import asyncio
asyncio.set_event_loop(None)

import importlib
import tornado

for mod in tornado.__all__:
    if mod == "curl_httpclient":
        # This module has extra dependencies; skip it if they're not installed.
        try:
            import pycurl
        except ImportError:
            continue
    importlib.import_module(f"tornado.{mod}")
s.  
import sys
import tornado

if "tornado.web" in sys.modules:
    raise Exception("unexpected eager import")

# Trigger a lazy import by referring to something in a submodule.
tornado.web.RequestHandler

if "tornado.web" not in sys.modules:
    raise Exception("lazy import did not update sys.modules")
c                   @   s$   e Zd Zdd Zdd Zdd ZdS )
ImportTestc                 C   s0   t jtjgt jd}|t | |jd d S N)stdinr   )	
subprocessPopensys
executablePIPEcommunicate_import_everythingassertEqual
returncodeselfproc r   </tmp/pip-unpacked-wheel-bmg6zs32/tornado/test/import_test.pytest_import_everything+   s    
z!ImportTest.test_import_everythingc                 C   s0   t jtjgt jd}|t | |jd d S r   )	r   r   r   r   r	   r
   _import_lazyr   r   r   r   r   r   test_lazy_import4   s    
zImportTest.test_lazy_importc                 C   sN   dd l }dd l}| |jj|jj | |jj|jj | |jj|j d S )Nr   )tornadoasyncioZassertIsZioloopTimeoutErrorutilgen)r   r   r   r   r   r   test_import_aliases:   s
    zImportTest.test_import_aliasesN)__name__
__module____qualname__r   r   r   r   r   r   r   r   *   s   	r   )r   r   Zunittestr   r   ZTestCaser   r   r   r   r   <module>   s
   