o
    װi                  
   @   s   d dl Z d dlZzd dlZd dlZdZW n ey, Z zdZdZeZW Y dZ[ndZ[ww dd Zdd Z	e r?G dd dZ
dd	d
dZdS )    Nc                   C   s   t d u ottdS )Nfixture)_errorhasattrpytest r   r   M/home/ubuntu/.local/lib/python3.10/site-packages/cupy/testing/_pytest_impl.pyis_available   s   r   c                 C   s"   t  std| ttjtd S )Nz2cupy.testing: {} is not available.

Reason: {}: {})r   RuntimeErrorformattyper   __name__)featurer   r   r   check_available   s
   r   c                       s0   e Zd Z fddZejdddd Z  ZS )_TestingParameterizeMixinc                    s   d t  | jS )Nz<{}  parameter: {}>)r
   super__repr____dict__)self	__class__r   r   r      s   z"_TestingParameterizeMixin.__repr__T)autousec                 C   s   | j rJ d| j | d S )Nz9There should not be another hack with instance attribute.)r   update)r   _cupy_testing_paramr   r   r   _cupy_testing_parameterize%   s   z4_TestingParameterizeMixin._cupy_testing_parameterize)r   
__module____qualname__r   r   r   r   __classcell__r   r   r   r   r      s    
r   T)_idsc                    sF   t d | rtjjj ndd   fddtD fdd}|S )Nparameterizec                 S   s   t |S )N)str)_iparamr   r   r   
param_name1   s   z parameterize.<locals>.param_namec                    s&   g | ]\}}t j| d ||dqS ) )id)r   r"   ).0r!   r"   )r#   r   r   
<listcomp>8   s    z parameterize.<locals>.<listcomp>c                    sV   t | tjrJ t | trtd| j}t| jt| fi } || _tj	
d | } | S )Nz$do not `@testing.parameterize` twicer   )
issubclassunittestTestCaser   r	   r   r   r   r   markparametrize)clsmodule_name)paramsr   r   f=   s   
zparameterize.<locals>.f)r   cupytesting_parameterized_make_class_name	enumerate)r   r/   r0   r   )r#   r/   r   r   ,   s   
	r   )r)   cupy.testing._parameterizedr1   r   _pytestr   ImportErrorer   r   r   r   r   r   r   r   <module>   s"    