관리-도구
편집 파일: test_cpp.cpython-38.pyc
U �g� � @ sx d dl mZ d dl mZ d dlZd dlZd dlZddlmZ ddlmZ ddlm Z G dd � d e�Z ed krte�� dS )� )�print_function)�absolute_importN� )�_test_extension_cpp)�TestCase)�WINc @ sH e Zd Zdd� Zdd� Zdd� Zdd� Ze�e d �d d� �Z dd � ZdS )�CPPTestsc C sX g }t d�D ]$}t�tj�}|�|� |�|� qt|�D ]\}}| �|�� |� q:d S )N� )�range�greenletr �test_exception_switch�switch�append� enumerateZassertEqual)�selfZ greenlets�i�g� r �G/opt/hc_python/lib64/python3.8/site-packages/greenlet/tests/test_cpp.pyr s zCPPTests.test_exception_switchc C s� dd l }dd l}|j�|j�t�d�}|j|t|t�s<|j n|g}|}| � tj��}tj |dtjd� W 5 Q R X |j}| �� } | �|j| � | �d|j� |jS )Nr zfail_cpp_exception.pyzutf-8)�encoding�stderrzfail_cpp_exception is running)�os�sys�path�join�dirname�__file__� executable� isinstance�str�__name__ZassertRaises� subprocess�CalledProcessError�check_output�STDOUT� exceptionZ,get_expected_returncodes_for_aborted_process�assertIn� returncode�output) r �targetr r �script�argsZ__traceback_info__�exc�exZ expected_exitr r r �_do_test_unhandled_exception s&