Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/awscli/__pycache__/ |
Upload File : |
o 2&�a�� � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlZddlZddl mZ ddlmZmZ ddlmZ ddlmZ ddlmZ ddlmZ dd lmZ dd lmZ ddlZddlmZ ddl Z!ddl"m#Z# dd l m$Z$ ddl!m%Z% ddlZej&r�ej'j(ej'_)ej*�+� Z,e�-d�Z.da/dd� Z0dd� Z1dd� Z2dd� Z3dd� Z4e j5dd� �Z6dSdd�Z7dd� Z8dTd"d#�Z9G d$d%� d%ej'�Z:G d&d'� d'e:�Z;G d(d)� d)e<�Z=G d*d+� d+e<�Z>e j5d,d-� �Z?e j5dUd/d0��Z@G d1d2� d2ej'�ZAG d3d4� d4eA�ZBG d5d6� d6ej'�ZCG d7d8� d8e<�ZDG d9d:� d:eE�ZFG d;d<� d<e<�ZGd=d>� ZH dVdAdB�ZIdCdD� ZJdEdF� ZKdGdH� ZLG dIdJ� dJej'�ZMG dKdL� dLe�ZNG dMdN� dNe<�ZOG dOdP� dPeE�ZPG dQdR� dRe<�ZQdS )Wa^ Test utilities for the AWS CLI. This module includes various classes/functions that help in writing CLI unit/integration tests. This module should not be imported by any module **except** for test code. This is included in the CLI package so that code that is not part of the CLI can still take advantage of all the testing utilities we provide. � N)�pformat)�Popen�PIPE)�mock)�StringIO)�six)�Session)�ClientError)�WaiterError)�AWSResponse)�load_plugins)� CLIDriver)�EnvironmentVariableszawscli.tests.integrationc s � fdd�}|S )z�Decorator to skip tests that should not be run on windows. Example usage: @skip_if_windows("Not valid") def test_some_non_windows_stuff(self): self.assertEqual(...) c s t �t�� dv� �| �S )N)�Darwin�Linux)�unittest�skipIf�platform�system)�func��reason� �2/usr/lib/python3/dist-packages/awscli/testutils.py� decoratorP s ��z"skip_if_windows.<locals>.decoratorr )r r r r r �skip_if_windowsF s r c C sF t j�� } | j}|�d��tj�}|sg }tj � |� |�dt� | S )N� data_path�data_loader)�awscli� clidriver�create_clidriver�session�get_config_variable�split�os�pathsep�_LOADER�search_paths�extend�register_component)�driverr! r r r r r V s r c C sb dd l } td u r/tj�tj�| j��}tj�|dd�}tj�|�s-t d�}|d u r-t d��|atS )Nr �bin�awsz�Could not find "aws" executable. Either make sure it is on your PATH, or you can explicitly set this value using "set_aws_cmd()")r �AWS_CMDr$ �path�dirname�abspath�__file__�join�isfile�_search_path_for_cmd� ValueError)r � repo_root�aws_cmdr r r �get_aws_cmda s r8 c C sB t j�dd��t j�D ]}t j�|| �}t j�|�r| S qd S )N�PATH� )r$ �environ�getr# r% r. r2 r3 )�cmd_namer. � full_cmd_pathr r r r4 s s �r4 c C s | a d S �N)r- )r7 r r r �set_aws_cmd{ s r@ c c s� � t �� }dttd�� }tj�||�}t|d��� z(t|| ��}|V W d � n1 s/w Y W t � |� dS W t � |� dS t � |� w )af This is a cross platform temporary file creation. tempfile.NamedTemporary file on windows creates a secure temp file that can't be read by other processes and can't be opened a second time. For tests, we generally *want* them to be read multiple times. The test fixture writes the temp file contents, the test reads the temp file. z tmpfile-%s� �wN)�tempfile�mkdtemp�str�random_charsr$ r. r2 �open�close�shutil�rmtree)�mode�temporary_directory�basename� full_filename�fr r r �temporary_file� s ���rP c C s� |sd}| j d|d�}|r|}nt� }d|i}|dkr!d|i|d<