Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/pbr/tests/__pycache__/test_wsgi.cpython-39.pyc
Ðазад
a i�hm � @ sr d dl Z d dlZd dlZd dlZzd dlmZ W n eyN d dlmZ Y n0 d dlm Z G dd� de j �ZdS )� N)�urlopen)�basec @ sB e Zd ZdZdd� Zdd� Zdd� Zdd d �Zdd� Zd d� Z dS )�TestWsgiScripts)� pbr_test_wsgiZpbr_test_wsgi_with_classc C sz t j�d| j �rd| j }nBt j�d| j �r<d| j }n$t j�d| j �rXd| j S td��d|tjd tjd f S ) Nz%s/lib64z%s/libz%s/site-packagesz.:%s/site-packagesz!Could not determine path for testz.:%s/python%s.%s/site-packagesr � )�os�path�isdir�temp_dir� Exception�sys�version_info)�selfr � r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/pbr/tests/test_wsgi.py� _get_path! s �zTestWsgiScripts._get_pathc C s: t jdkr| �d� | �dd| j �\}}}| �|� dS )z5Test that we install a non-pkg-resources wsgi script.�nt�Windows support is passthrough�install�--prefix=%sN)r �name�skipTest� run_setupr �_check_wsgi_install_content�r �stdout�_�return_coder r r �test_wsgi_script_install/ s � z(TestWsgiScripts.test_wsgi_script_installc C sR t jdkr| �d� | �dd| j �\}}}| �|� | jD ]}| �|d� q<dS )z�Test that we install a runnable wsgi script. This test actually attempts to start and interact with the wsgi script in question to demonstrate that it's a working wsgi script using simple server. r r r r s Hello WorldN)r r r r r r � cmd_names� _test_wsgi)r r r r �cmd_namer r r �test_wsgi_script_run9 s � z$TestWsgiScripts.test_wsgi_script_runNc C s> t j�| jd|�}td| � |ddddg}|r:|�|� d| �� i}tj|tj tj | j|d�}| � |j� |j� � }|j� � }| �d |� |j� � }t|� t�d |�} | �| d| � |j� � }| �d|� |j� � }t| �d ��d��} | �|| �� � t| �d ��d�� |j� � }dt|� }| �|�d�|� d S )N�binzRunning %s -p 0 -b 127.0.0.1z-p�0z-bz 127.0.0.1� PYTHONPATH)r �stderr�cwd�envs) STARTING test server pbr_testpackage.wsgis (http://[^:]+:\d+)/zRegex failed to match on %ss2 DANGER! For testing only, do not use in productionr zutf-8z"GET / HTTP/1.1" 200 %d)r r �joinr �print�extendr � subprocess�Popen�PIPEZ addCleanup�killr �readline�assertIn�re�searchZassertIsNotNoner �group�decodeZassertEqual�readr&